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.

read/write to internal registers?

Status
Not open for further replies.

tuanvoi

New Member
hi all,
Could you please show me how to read/write to internal registers such as Timer, HIGH/LOW-VOLTAGE DETECT(HLVD) register for pic18f4550? Thank you a lot.
Tom
 
I wonder which compiler ur using. Assuming it is the C18 or some other C compiler all U need to do is jus write
TMRO=0x00; writes 00 in hex to TMRO SFR
similarly U can do with all other SFRS provided that U have already included the ehader file having the details of all other SfRs in ur PROJECT worksapace.
Good LUCk MATE
 
He could even be using an assembler.

The registers are defined by a processor definition file. In asm it would be an include file like processorName.inc. In C it is a header file , for C18 it would be processorName.h.

The register names and how to access them are determined by these file. Study them.
 
hi,
I'm using CCS C compiler. How would I read/write? Thanks
Sorry, I'm new to this thing.

Take a look at the header file for your PIC. You should find you can set it very simply as long as you know the correct name.

The file will be named something like 18f1320.h

You could also check this page (or their examples).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top