469,889 Members | 1,416 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,889 developers. It's quick & easy.

Sending commands to PIC using Pyserial

Hello all,

I am attempting to send commands to the firmware on my PIC18F4550 (usb port) microcontroller using Pyserial. If I open Hyperterminal, I can send the following commands and it works beautifully:


Then I went to Python with Pyserial, and nothing happens. I get no errors, but at the same time the board does not respond to the input, and python prints no output.

Here is my code:

import serial

ser = serial.Serial(7)
ser.timeout = 2
reply = ser.read(7)
print reply

7 = COM8
The timeout I put in just so that it wouldn't sit there forever. I should be reading something in this time.
I only included \r because this is all the firmware looks for. But just for trial and error sake, I tried \n , \n\r , and \r\n just to be sure.

The electronics on the board do not matter -- as I said, it works with Hyperterminal. There seems to be an issue with my code.

I receive no errors when I execute my code, either.

I appreciate any insight to this problem whatsoever! :)

Mar 20 '08 #1
0 1721

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

13 posts views Thread by Bob Greschke | last post: by
4 posts views Thread by Zarathustra | last post: by
11 posts views Thread by Timothy Smith | last post: by
reply views Thread by [david] | last post: by
1 post views Thread by Rich | last post: by
reply views Thread by Gabriel Genellina | last post: by
2 posts views Thread by Holger | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.