Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/06/06 05:18
Read: times


 
#106670 - SDCC C code problem...
Hi friends

I the following SDCC C code

- my aim is to assign 2 byte of the TIMER0 to unsigned int "i"

when Iam assigning TH0 to "i" port1 is showing FFh( not working ). but when j is assigned to i port is showing 6h(working).

in first case why code is not working and in other case it is working why?
so I request to everybody to help in this regard

#include<8052.h>
void main(void){

unsigned int i = 0xffff;
unsigned char j = 0xff;

TH0 = 0xff;
TL0 = 0xff;
i = TH0;
// i = j;
i = i << 8;
P1 = i/10000;// P1 should display 6

}

List of 14 messages in thread
TopicAuthorDate
SDCC C code problem...            01/01/70 00:00      
   can you generate an ASM file of the same            01/01/70 00:00      
   Last line            01/01/70 00:00      
      but how it works whne j is assigned ...            01/01/70 00:00      
         its working fine in keil            01/01/70 00:00      
   P1 = 0x06 using SDCC.            01/01/70 00:00      
      P1 = 0x06 using SDCC            01/01/70 00:00      
   Screen Dump showing P1 = 0x06            01/01/70 00:00      
   SDCC ver 2.4 P1=06 SDCC ver 2.5 P1=FF            01/01/70 00:00      
      Type cast            01/01/70 00:00      
         Whats the results if Type Cast?......            01/01/70 00:00      
            SDCC C            01/01/70 00:00      
               SDCC C CODE PROBLEM..            01/01/70 00:00      
            SDCC C            01/01/70 00:00      

Back to Subject List