Jump to content

Greg

Members
  • Content Count

    3
  • Joined

  • Last visited

    Never

Community Reputation

0 Neutral

About Greg

  • Rank
    Newbrie
  1. Hi, I would like to do this: if((shortA+shortB)>0xFFFF) { shortA++; } but the compiler tells me it is too complicated as they are 16 bit variables, could anyone help me by giving me an example of how i could do it differently? Thanks Greg
  2. Hi, I am writing some code using the PIC16f877 and comunication with another chip, and printf is printing to the serial line. I call this function ioRead twice within the program first time it runs fine and the second time as soon as it gets to the "clear_bit(PORTC,IOR);" bit it stops, it doesnt execute this, it just stops running then resets to the begining of the program, why does this happen? here is a snippet of the code: char ioRead(char addr) { // set data bus to input TRISB=0xff; // set the address to the specified address PORTA=addr; printf("Ports initialised now set chipsel\n\r"); clear_bit(PORTC,CHIPSEL); printf("Now set the IOR bit\n\r"); clear_bit(PORTC,IOR); printf("now set value to be portb\n\r"); value=PORTB; printf("Now reset the bits back\n\r"); set_bit(PORTC,IOR); set_bit(PORTC,CHIPSEL); printf("now return the value!\n\r"); return(value); } Thanks in advance, any help very much appreciated, Greg
  3. Hi, I am using c2c c compiler and am trying to work out how i can pass the contents of say register PORTB to the serial line? ie using putchar. any help much appreciated, thanks in advance Greg
×
×
  • Create New...