@JohnInTX I followed that thread, Sample code worked on my PIC Development boardFor the comms, read this thread and try the sample codes.
https://forum.allaboutcircuits.com/threads/uart-register-configuration.158219/!
This is a simple C program that demonstrates the basic idea to check one condotion
Code:
#include<stdio.h>
int main (void)
{
int sensor = 1, sensorstate;
printf("Please check sensor : ");
scanf("%d", &sensorstate );
printf("sensor is : %d \n", sensorstate);
if(sensor == sensorstate)
{
printf("Sensor High \n");
}
else
{
printf("sensor Low \n");
}
return 0;
}
A Sensor gives outputs a 1 when seeing something and a 0 otherwise.
Code:
void main(void)
{
while(1)
{
if (SENSOR == 1)
{
printf("\rThe Sensor is: %d", SENSOR);
}
else
{
printf("\rThe Sensor is: %d", SENSOR);
}
}
}
- convert the count to ASCII and write it to the UART - use 'printf' for this.
Can you show the part of your code to send integer value to PC port?
Last edited:


