Dec 23, 2008 #1 E eem2am Banned 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
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
Dec 23, 2008 #2 B btbass Advanced Member level 5 Joined Jul 20, 2001 Messages 1,896 Helped 438 Reputation 880 Reaction score 288 Trophy points 1,363 Location Oberon Activity points 12,887 The following code should work. Code: unsigned int duty_cycle; PDC0H = (unsigned char)(duty_cycle >> 8); PDC0L = (unsigned char)(duty_cycle & 0x00ff);
The following code should work. Code: unsigned int duty_cycle; PDC0H = (unsigned char)(duty_cycle >> 8); PDC0L = (unsigned char)(duty_cycle & 0x00ff);