Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC18F1230 register loading

Status
Not open for further replies.

eem2am

Banned
Advanced Member level 4
Joined
Jun 22, 2008
Messages
1,179
Helped
37
Reputation
74
Reaction score
24
Trophy points
1,318
Activity points
0
Hello,

i am using PIC18F1230 and C18 C compiler.

I wish to load an unsigned int (16 bit) into the two 8 bit registers which represent the duty cycle value (PDC0H & PDC0L).

Do readers know how i can do this, which statement i can use?

most grateful for replies
 

The following code should work.

Code:
unsigned int duty_cycle;

PDC0H = (unsigned char)(duty_cycle >> 8);
PDC0L = (unsigned char)(duty_cycle & 0x00ff);
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top