UART again

Hi,
I am back on to my uart program.
I have attached a script called “uarttest.py”.

I am sending a single character , ‘v’, from a dsPIC u_processor UART at 9600 baud. I have the transmit pin of the dsPIC UART wired to the P0 pin on the CAM7. The dsPIC is transmitting the character “v” in a loop. My oscilloscope is hooked to the input to the CAM7 at pin P0. The scope shows that the character ‘v’ , ASCII b’01110110’, is being sent properly. High is 3.24 Volts, and low is 4 mV. Can you look at my script and see what I’m doing wrong?

Thanks,
Jim Sullivan
P.S. Excuse the extra .py on the file name.
uarttest.py.py (306 Bytes)

You probably noticed that I had the baud rate @19200. I changed this to a baud rate of 9600, however the result was the same. The output of print(takepic) command in the serial terminal
was , and not the character ‘v’.

Another mistake. I think I was supposed to be CAM 7 P5 , UART 3. I changed to pin 5, however the results were the same.

Hi, since you’re using P0 you should use UART1 (using whatever baudrate you’re using on the PIC):

uart = UART(1, 19200, timeout_char=1000)

Oh I see the problem, you’re not calling the function:

takepic=UART.readchar

Should be:

takepic=UART.readchar()

Also UART is the module not the object you created, so it should be

takepic=uart.readchar()

Hi,
It works!!
thanks,
jim