UART again

Discussion related to "under the hood" OpenMV topics.
pcls1026
Posts: 72
Joined: Tue Aug 22, 2017 1:33 am

UART again

Postby pcls1026 » Sat Dec 08, 2018 6:43 pm

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.
Attachments
uarttest.py.py
(306 Bytes) Downloaded 71 times
pcls1026
Posts: 72
Joined: Tue Aug 22, 2017 1:33 am

Re: UART again

Postby pcls1026 » Sat Dec 08, 2018 6:52 pm

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'.
pcls1026
Posts: 72
Joined: Tue Aug 22, 2017 1:33 am

Re: UART again

Postby pcls1026 » Sat Dec 08, 2018 7:14 pm

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.
User avatar
iabdalkader
Posts: 845
Joined: Sun May 24, 2015 3:53 pm

Re: UART again

Postby iabdalkader » Sat Dec 08, 2018 7:15 pm

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)
User avatar
iabdalkader
Posts: 845
Joined: Sun May 24, 2015 3:53 pm

Re: UART again

Postby iabdalkader » Sat Dec 08, 2018 7:32 pm

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()
pcls1026
Posts: 72
Joined: Tue Aug 22, 2017 1:33 am

Re: UART again

Postby pcls1026 » Sun Dec 09, 2018 6:53 pm

Hi,
It works!!
thanks,
jim

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 129 guests