Page 1 of 1

UART again

Posted: Sat Dec 08, 2018 6:43 pm
by pcls1026
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.

Re: UART again

Posted: Sat Dec 08, 2018 6:52 pm
by pcls1026
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 <function>, and not the character 'v'.

Re: UART again

Posted: Sat Dec 08, 2018 7:14 pm
by pcls1026
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.

Re: UART again

Posted: Sat Dec 08, 2018 7:15 pm
by iabdalkader
Hi, since you're using P0 you should use UART1 (using whatever baudrate you're using on the PIC):

Code: Select all

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

Re: UART again

Posted: Sat Dec 08, 2018 7:32 pm
by iabdalkader
Oh I see the problem, you're not calling the function:

Code: Select all

takepic=UART.readchar
Should be:

Code: Select all

takepic=UART.readchar()
Also UART is the module not the object you created, so it should be

Code: Select all

takepic=uart.readchar()

Re: UART again

Posted: Sun Dec 09, 2018 6:53 pm
by pcls1026
Hi,
It works!!
thanks,
jim