Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Hi-Tech C book ?

Status
Not open for further replies.

5uco

Member
Anyone know of a suitable book that includes info. on coding with Hi-Tech C from square one?
Recently started C, getting on reasnoably well with C18 but it doesn't do 16F's.

Which is a bit annoying as I have quite a number.

Dave
 
Last edited:
Take a look at "123 PIC Microcontroller Experiments for the Evil Genius", by Myke Predko. It might suit your needs.
 
Take a look at "123 PIC Microcontroller Experiments for the Evil Genius", by Myke Predko. It might suit your needs.

Thanks Odin, had a look at Amazon, and it may well be useful.

Ordered one anyway, not particularly expensive ..

D.
 
The two compilers are not all that different. If you take a look at a few c programs written in HiTech you should be ok.

Hi 3V0

No, they are not all that different, but they are in some respects ...

OK. I can do .... if (PORTAbits.RA2 == 0) in C18, it does what I want .

Cannot, so far, find the equivalent in Hi-Tech C. I have no doubt it CAN, but what is the syntax ? Hi-Tech C won't compile that statement.

Not only that, just given as an example. Nice if I could find the wretched info. in one place...

D.
 
Just read the manual, it will tell you the syntax required for various initiatives. When you download the HI-TECH compiler, there should be a PDF file of the manual stored in the HI-TECH file. Otherwise, I'm sure it can be found online as well.
 
Look in you hiTech header files.

For this header fragment from the 18F1220.h file will explain your problem.

Code:
/* Definitions for PORTA register */
extern volatile near bit    RA0        @ ((unsigned)&PORTA*8)+0;
extern volatile near bit    RA1        @ ((unsigned)&PORTA*8)+1;
extern volatile near bit    RA2        @ ((unsigned)&PORTA*8)+2;
extern volatile near bit    RA3        @ ((unsigned)&PORTA*8)+3;
extern volatile near bit    RA4        @ ((unsigned)&PORTA*8)+4;
extern volatile near bit    RA5        @ ((unsigned)&PORTA*8)+5;
extern volatile near bit    RA6        @ ((unsigned)&PORTA*8)+6;
extern volatile near bit    RA7        @ ((unsigned)&PORTA*8)+7;
We do not have the union/structure thing going on as with the C18 compiler. The union in C18 causes us to use PORTA for the byte and PORTAbits for the bits. In the hiTech compiler we just use the names for the bits.

Give this a try.
if (RA2 == 0)

You will find many of the answers to your question in the processor header files.

Glad to help if you get stuck.
 
Last edited:
ENO, 3V0

Thanks for the tips, will try again when I get to the PC with the PIC stuff on.

D.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top