Holtek C and ANSI C Feature Comparison User s Guide

Similar documents
Writing an ANSI C Program Getting Ready to Program A First Program Variables, Expressions, and Assignments Initialization The Use of #define and

IAR EWARM Quick Start for. Holtek s HT32 Series Microcontrollers

EIC-300 User s Guide

Holtek e-link for 8-bit MCU OCDS User s Guide

Partial Lock Writer User s Guide

Keil TM MDK-ARM Quick Start for. Holtek s HT32 Series Microcontrollers

Language Design COMS W4115. Prof. Stephen A. Edwards Spring 2003 Columbia University Department of Computer Science

HT82M98A. 3-Key 3D USB+PS/2 Mouse Controller. Features. General Description. Block Diagram

CprE 288 Introduction to Embedded Systems Exam 1 Review. 1

DETAILED SYLLABUS INTRODUCTION TO C LANGUAGE

HT36B0 8-Bit Music Synthesizer MCU

Language Design COMS W4115. Prof. Stephen A. Edwards Fall 2006 Columbia University Department of Computer Science

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

HT24LC02. CMOS 2K 2-Wire Serial EEPROM. Pin Assignment. Features. General Description. Block Diagram. Pin Description


Review of the C Programming Language for Principles of Operating Systems

ZiLOG Z8 Encore! Compiler Compliance With ANSI STANDARD C

Dr M Kasim A Jalil. Faculty of Mechanical Engineering UTM (source: Deitel Associates & Pearson)

Fundamental Data Types. CSE 130: Introduction to Programming in C Stony Brook University

Functions. Angela Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan.

Chapter 15 - C++ As A "Better C"

Lecture 02 C FUNDAMENTALS

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 4

6.096 Introduction to C++ January (IAP) 2009

Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9

Tutorial 5. PDS Lab Section 16 Autumn Functions The C language is termed as function-oriented programming

Review of the C Programming Language

Recap. ANSI C Reserved Words C++ Multimedia Programming Lecture 2. Erwin M. Bakker Joachim Rijsdam

CSCI 171 Chapter Outlines


MPLAB C1X Quick Reference Card

The C Language Reference Manual

C Programming SYLLABUS COVERAGE SYLLABUS IN DETAILS

INTRODUCTION TO C++ FUNCTIONS. Dept. of Electronic Engineering, NCHU. Original slides are from

ANSI C Programming Simple Programs

The component base of C language. Nguyễn Dũng Faculty of IT Hue College of Science

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

Axivion Bauhaus Suite Technical Factsheet MISRA

DEPARTMENT OF MATHS, MJ COLLEGE

Programming. C++ Basics

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

CODE TIME TECHNOLOGIES. Abassi RTOS MISRA-C:2004. Compliance Report

PERIYAR CENTENARY POLYTECHNIC COLLEGE Periyar Nagar- Vallam Thanjavur

Data Type Fall 2014 Jinkyu Jeong

ECE 2400 Computer Systems Programming Fall 2017 Topic 12: Transition from C to C++

This is a preview - click here to buy the full publication INTERNATIONAL STANDARD. Programming languages - C. Langages de programmation - C

Presented By : Gaurav Juneja

A Fast Review of C Essentials Part I

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9

EL6483: Brief Overview of C Programming Language

A S H O R T I S H O V E R V I E W O F T H E A N S I C P R O G R A M M I N G L A N G U A G E

CMPE-013/L. Introduction to C Programming

Fundamentals of Programming

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

Motor Industry Software Reliability Association (MISRA) C:2012 Standard Mapping of MISRA C:2012 items to Goanna checks

C: How to Program. Week /Mar/05

Computers Programming Course 5. Iulian Năstac

BLM2031 Structured Programming. Zeyneb KURT

by Pearson Education, Inc. All Rights Reserved.

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

AIR FORCE SCHOOL,BAMRAULI COMPUTER SCIENCE (083) CLASS XI Split up Syllabus (Session ) Contents

Review: Constants. Modules and Interfaces. Modules. Clients, Interfaces, Implementations. Client. Interface. Implementation

Computers Programming Course 6. Iulian Năstac

Programming Fundamentals for Engineers Functions. Muntaser Abulafi Yacoub Sabatin Omar Qaraeen. Modular programming.

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

Programming and Data Structures

ET156 Introduction to C Programming

Chapter 2 - Introduction to C Programming

C-LANGUAGE CURRICULAM

CSE123. Program Design and Modular Programming Functions 1-1

Informática Ingeniería en Electrónica y Automática Industrial

C Syntax Out: 15 September, 1995

QUIZ. 1. Explain the meaning of the angle brackets in the declaration of v below:

M1-R4: Programing and Problem Solving using C (JULY 2018)

Fundamental of Programming (C)

Binghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program

HP C Language Reference Manual

This document is a preview generated by EVS

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Computer Programming

Introduction to C++ Systems Programming

ET156 Introduction to C Programming

Short Notes of CS201

C Programming Multiple. Choice

Programming in C++ 4. The lexical basis of C++

EPITA SPE C Workshop - D0

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

Week 1 / Lecture 2 8 March 2017 NWEN 241 C Fundamentals. Alvin Valera. School of Engineering and Computer Science Victoria University of Wellington

Introduction to C++ Introduction. Structure of a C++ Program. Structure of a C++ Program. C++ widely-used general-purpose programming language

The Waite Group's. New. Primer Plus. Second Edition. Mitchell Waite and Stephen Prata SAMS

ECE 2400 Computer Systems Programming Fall 2018 Topic 11: Transition to C++

CS201 - Introduction to Programming Glossary By

from Appendix B: Some C Essentials

Main Program. C Programming Notes. #include <stdio.h> main() { printf( Hello ); } Comments: /* comment */ //comment. Dr. Karne Towson University

Introduction to the C Programming Language

Variables in C. Variables in C. What Are Variables in C? CMSC 104, Fall 2012 John Y. Park

Introduction to C++ with content from

Chapter 2: Overview of C. Problem Solving & Program Design in C

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

Programming in C Quick Start! Biostatistics 615 Lecture 4

Transcription:

Holtek C and ANSI C Feature Comparison User s Guide July 2009 Copyright 2009 by HOLTEK SEMICONDUCTOR INC. All rights reserved. Printed in Taiwan. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form by any means, electronic, mechanical photocopying, recording, or otherwise without the prior written permission of HOLTEK SEMICONDUCTOR INC.

NOTICE The information appearing in this User s Guide is believed to be accurate at the time of publication. However, Holtek assumes no responsibility arising from the use of the specifications described. The applications mentioned herein are used solely for the purpose of illustration and Holtek makes no warranty or representation that such applications will be suitable without further modification, nor recommends the use of its products for application that may present a risk to human life due to malfunction or otherwise. Holtek reserves the right to alter its products without prior notification. For the most up-to-date information, please visit our web site at http://www.holtek.com.tw.

Contents Contents Data Types and Sizes...1 Arrays...2 Reserved Keywords...2 Operators...4 Preprocessor Directive #pragma...5 Constant Variables...5 Predefined Headers...6 Main Function...6 Interrupt Function...7 Built-in Functions...7 Other Functions...8

Software version Holtek C Enhanced Holtek C Holtek (R) Cross C Compiler Version V2.02 MRSC Holtek (R) Cross C Compiler Version V2.36 E-MRSC (2008/5/22) Note Y indicates a Yes and N indicates a No in the following sections of this DOC. Data Types and Sizes Holtek C Enhanced Holtek C ANSI C Data Type Size (bits) Size (bits) Size (bits) Bit 1 1 N Char 8 8 8 signed char 8 8 8 Unsigned char 8 8 8 Short 8 16 16 Unsigned short 8 16 16 Int 8 16 16 unsigned int 8 16 16 Long 16 32 32 unsigned long 16 32 32 Void 0 0 0 Float N 32 32 Double N 32 64 Long double N N 128 Float and double are both 32-bit format of the IEEE 754 spec. 1

Arrays Holtek C Enhanced Holtek C ANSI C Dimension (Max Size) (Max Size) (Max Size) 1-Dimensional Y (256) Y (256) Y 2-Dimensional N Y (256) Y 3 or above Dimensional N N Y Array of pointers N Y (256) Y Function Array N Y (256) Y Reserved Keywords Keywords Holtek C Enhanced Holtek C ANSI C auto break bit Y Y N Case char const constant N Y N continue default do double N Y Y else enum extern float N Y Y for goto if int 2

Keywords Holtek C Enhanced Holtek C ANSI C auto long register N Y Y return short signed sizeof static struct switch typedef union unsigned void volatile while 3

Operators Operators Holtek C Enhanced Holtek C ANSI C Arithmetic operators (+-*/%) Relational operators (> < == >= <=!=) Logical operators (! && ) Bitwise operators (<< >> ~ ^ &) Assignment operators (= += -= *= /= %= >>= <<= &= ^= =) Conditional operators (? :) Comma operator (,) Reference operator (* &) Size-of operator (sizeof) Cast operator ((Tpe)) Member operators (. ->) Subscription operator ([ ]) Function call operator (( )) Increment operator (++) Decrement operator (--) Unary minus operator (-) Unary plus operator (+) Y Y N Operator to specify RAM variable address (@) Y Y N 4

Preprocessor Directive #pragma Syntax: #pragma keyword [option] Some options may exist for some keywords. Keyword Holtek C Enhanced Holtek C ANSI C Option bp_free N Y N N Bp_nofree N Y N N function N Y N Y nobp N Y N N nolocal N Y N Y nomp0 N Y N N nomp1 N Y N N rambank0 norambank Y Y N N Rombank0 norombank N Y N N rombank N Y N Y vector Y Y N Y novectornest N Y N N Constant Variables Constant Variable Holtek C Enhanced Holtek C ANSI C Adaptive data type any any any Attribute public/relocatable private public/private/internal Can be invoked by other files N Y (Add extern directive before const) Y (Add extern directive before const) Must be declared as global variable Must be initialized when declared Must specify the dimension for constant array Constant strings must be used in the C file with main function Y Y N 5

Predefined Headers Header File Holtek C Enhanced Holtek C ANSI C HTxxxxxx.h Y Y N assert.h N N Y ctype.h N N Y errno.h N N Y float.h N N Y limits.h N N Y locale.h N N Y math..h N N Y setjmp.h N N Y signal.h N N Y stdarg.h N N Y stddef.h N N Y stdio.h N N Y stdlib.h N N Y string.h N N Y time.h N N Y Main Function Rule Holtek C Enhanced Holtek C ANSI C Number 1 1 1 Return type void void void Argument No No 2 6

Interrupt Function Rule Holtek C Enhanced Holtek C ANSI C For setup interrupt vector Y Y Number multiple multiple Return type void void Argument N N Reentrant allowed N Y (1) No interrupt function for ANSI C Call ISR explicitly in programs N N Call functions in ISR N (2) N (2) (1) It is only for these kinds of MCU that nested interrupts are allowed. It should be noted that the same interrupt cannot be nested at all times. (2) The user defined function written in C should not be called within the ISR. It is safe to use system calls. If it is desired to call a function within the ISR, then it should be written in assembly. It is safe to call the built-in function within the ISR. Built-in Functions Operators Holtek C (Argument) Enhanced Holtek C (Argument) ANSI C _clrwdt() Y Y N _clrwdt1() Y Y N _clrwdt2() Y Y N _halt() Y Y N _nop() Y Y N _rr(int *) Y(int *) Y(char *p) N _rrc(int *) Y(int *) N _lrr(long *) Y(long *) Y(int *pl) N _lrrc(long *) Y(long *) N _rl(int *) Y(int *) Y(char *p) N _rlc(int *) Y(int *) N _lrl(long *) Y(long *) Y(int *pl) N _lrlc(long *) Y(long *) N _swap(int *) Y(int *) Y(char *p) N 7

Operators Holtek C (Argument) Enhanced Holtek C (Argument) ANSI C _delay(unsigned long tick) Y(tick<=65535) Y(tick<=263690) N Mathematical functions N N Y Character and string functions N N Y Standard Input/output function N N Y Dunamic memory allocation functions N N Y The standard C libraries (math, string, stdio, stdlib ) are not supported by the Holtek C compilers. Other Functions Operators Holtek C Enhanced Holtek C ANSI C In line assembly Y Y N Static variable No local static variable No local static variable A local static variable is allowed Constant Support binary constant value Support binary constant value NOT Support binary constant value function No reentrant and recursive allowed No reentrant and recursive allowed Support reentrant and recursive Pointer Not for constant and bit variable Not for constant and bit variable Not for constant (no bit variable) Initialization No for global variables. Yes for local variables. Necessary for constant variables. No for global variables. Yes for local variables. Necessary for constant variables. Yes for both global and local variables. Necessary for constant variables. stack Limited level (1) Limited level (1) Unlimited level (1) For HOLTEK C/Enhanced HOLTEK C, the stack level limit during function calls in the program must be considered. 8

The stack level consumption of some operators and functions are as follows: Operator/Function Holtek C Enhanced Holtek C ANSI C main() 0 _rl(int */ char *p); 0 _clrwdt() 0 _rlc(int *); 0 _clrwdt1() 0 _lrl(long */ int *pl); 0 _clrwdt2() 0 _lrlc(long *); 0 _halt() 0 _delay(unsigned long) 1 _nop() 0 * 1 _rr(int */ char *p); 0 / 1 _rrc(int *); 0 % 1 _lrr(long */ int *pl); 0 Constant array 1 _lrrc(long *); 0 9

Holtek Semiconductor Inc. (Headquarters) No.3, Creation Rd. II, Science Park, Hsinchu, Taiwan Tel: 886-3-563-1999 Fax: 886-3-563-1189 http://www.holtek.com.tw Holtek Semiconductor Inc. (Taipei Sales Office) 4F-2, No. 3-2, YuanQu St., Nankang Software Park, Taipei 115, Taiwan Tel: 886-2-2655-7070 Fax: 886-2-2655-7373 Fax: 886-2-2655-7383 (International sales hotline) Holtek Semiconductor Inc. (Shenzhen Sales Office) 5F, Unit A, Productivity Building, No.5 Gaoxin M 2nd Road, Nanshan District, Shenzhen, China 518057 Tel: 86-755-8616-9908, 86-755-8616-9308 Fax: 86-755-8616-9722 Holtek Semiconductor (USA), Inc. (North America Sales Office) 46729 Fremont Blvd., Fremont, CA 94538 Tel: 1-510-252-9880 Fax: 1-510-252-9885 http://www.holtek.com Copyright 2009 by HOLTEK SEMICONDUCTOR INC. The information appearing in this User s Guide is believed to be accurate at the time of publication. However, Holtek assumes no responsibility arising from the use of the specifications described. The applications mentioned herein are used solely for the purpose of illustration and Holtek makes no warranty or representation that such applications will be suitable without further modification, nor recommends the use of its products for application that may present a risk to human life due to malfunction or otherwise. Holtek s products are not authorized for use as critical components in life support devices or systems. Holtek reserves the right to alter its products without prior notification. For the most up-to-date information, please visit our web site at http://www.holtek.com.tw. 10