Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
unsigned char GetChar(){
unsigned char chr,x;
TRISAbits.TRISA0=1;
while(PORTAbits.RA0==1); //wait for start bit
Delay10TCYx(30); //150uS =one and half bit
for(x=0;x<8;x++){
chr>>=1;
if(PORTAbits.RA0==1)
chr+=0x80;
Delay10TCYx(20);
}
return chr;
}
Comes in a few variations for things like not having all bits on the same port etc.
Wouldn't that be called parallel?![]()
[FONT=Arial, Helvetica, sans-serif][FONT=Arial, Helvetica, sans-serif]Q. I want a routine to do a serial port in software, because I’m using a low-end PIC.[/FONT]
[FONT=Arial, Helvetica, sans-serif]Go to directory ‘c:\ht-pic\samples’ and look at files ‘serial.c’ and ‘iserial.c’. The second file receives characters into a buffer in the background, using interrupts. Its almost like the hardware serial port on a high-end PIC.[/FONT]