Re: is there a problem on this simple code

2005-03-31 Thread jrlen balane
i would just like to apologize for my mistake, rest assured everything was taken in helpful way. On Thu, 31 Mar 2005 17:40:06 GMT, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 31 Mar 2005 10:56:07 -0500, Peter Hansen <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: >

Re: is there a problem on this simple code

2005-03-31 Thread Peter Hansen
jrlen balane wrote: hi! could anyone give their input on my previous post about timer and threading...] pleaseee... A few bits of unrequested advice which might help you get more and better responses (though the ones you have got in the past already appear to be above and beyond the call of duty, g

Re: is there a problem on this simple code

2005-03-31 Thread jrlen balane
hi! could anyone give their input on my previous post about timer and threading...] pleaseee... my program seemed to just run first the thread then when it encounters error on the thread that's the time that other part of the program got the chance to be executed even the timer even is not execute

Re: is there a problem on this simple code

2005-03-30 Thread jrlen balane
a simple question regarding threading and timer: if i put my timer control inside the thread, will the thread be exited every time there is a timer event??? please help... def someThreadHere() ... someTimer.start(3000) def someTimerEvent() . On Wed, 16 Mar 2005

Re: is there a problem on this simple code

2005-03-15 Thread Tim Roberts
jrlen balane <[EMAIL PROTECTED]> wrote: >why is it that here: > >1)rx_data = ser.read(10) >(rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, >pyra2, voltage, current, rx_checksum) = unpack('10B', rx_data) >print rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, >pyra2,

Re: is there a problem on this simple code

2005-03-15 Thread John Machin
jrlen balane wrote: [from further down in the message] > could somebody out there help me. You could try helping yourself. Insert some print statements at salient points. [see examples below; you'll need to get the indentation correct, of course] Try to understand what is happening. > ok heres

Re: is there a problem on this simple code

2005-03-15 Thread jrlen balane
please post your suggestions? please ... On Wed, 16 Mar 2005 08:33:23 +0800, jrlen balane <[EMAIL PROTECTED]> wrote: > ok heres the code, i'm trying on IDLE: > > import sys > import serial > import sys, os > import serial > import string > import time > from struct import * > > data_file = open

Re: is there a problem on this simple code

2005-03-15 Thread jrlen balane
ok heres the code, i'm trying on IDLE: import sys import serial import sys, os import serial import string import time from struct import * data_file = open('C:/Documents and Settings/nyer/Desktop/IRRADIANCE.txt', 'r') data = data_file.readlines() def process(list_of_lines): data_points = []

Re: is there a problem on this simple code

2005-03-15 Thread jrlen balane
will this be correct??? what i want to happen is saved every received data (6 data bytes) to an array for each one. for k in range (rx_len-9): if byte[k] == 70 and byte [k+2] == 6 and sum(byte[k:k+10]) & 0xff == 0: #print byte[k:k+10] temp1.append(byte[k+

Re: is there a problem on this simple code

2005-03-15 Thread John Machin
jrlen balane wrote: > did some editing: > The error means that you received less than 19 bytes of data. > rx_data = ser.read(19) !rx_len = len(rx_data) !print 'rx_len', rx_len > byte[0:18] = unpack('19B', rx_data) !# trash the above, do this !byte = [ord(x) for x in rx_data] !print 'received', b

Re: is there a problem on this simple code

2005-03-15 Thread jrlen balane
did some editing: rx_data = ser.read(19) byte[0:18] = unpack('19B', rx_data) for k in range(9): if byte[k] == 70: if byte[k+2] == 6: if byte[k+9] == -(byte[k]+byte[k+1]+byte[k+2]+byte[k+3]+byte[k+4]+byte[k+5]+byte[k+6]+byte[k+7]+byte[k+8]) & 0xff:

Re: is there a problem on this simple code

2005-03-15 Thread jrlen balane
rx_data = ser.read(19) byte[] = unpack('19B', rx_data) for k in range(9): if byte[k] == 70 if byte[k+2] == 6 if byte[k+9] == -(byte[k]+byte[k+1]+byte[k+2]+byte[k+3]+byte[k+4]+byte[k+5]+byte[k+6]+byte[k+7]+byte[k+8]) & 0xff print byte[

Re: is there a problem on this simple code

2005-03-14 Thread John Machin
jrlen balane wrote: > @sir John > could you please show me how to do this exactly? it's in the "tip of > my toungue" but i just can get it, please... > You've had far too much help already for a school project. Asking for someone to write the code for you is "over the fence". -- http://mail.pyt

Re: is there a problem on this simple code

2005-03-14 Thread jrlen balane
@sir John could you please show me how to do this exactly? it's in the "tip of my toungue" but i just can get it, please... On 14 Mar 2005 14:06:15 -0800, John Machin <[EMAIL PROTECTED]> wrote: > > jrlen balane wrote: > > why is it that here: > > > > 1)rx_data = ser.read(10) > > (rx_command,

Re: is there a problem on this simple code

2005-03-14 Thread John Machin
jrlen balane wrote: > why is it that here: > > 1)rx_data = ser.read(10) > (rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, > pyra2, voltage, current, rx_checksum) = unpack('10B', rx_data) > print rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, > pyra2, voltage, curr

Re: is there a problem on this simple code

2005-03-14 Thread jrlen balane
why is it that here: 1)rx_data = ser.read(10) (rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, pyra2, voltage, current, rx_checksum) = unpack('10B', rx_data) print rx_command, rx_msg_no, rx_no_databyte, temp1, temp2, pyra1, pyra2, voltage, current, rx_checksum >>> type (rx_co

Re: is there a problem on this simple code

2005-03-13 Thread John Machin
Jan Rienyer Gadil wrote: > @ sir Peter > so you mean that it is correct (at least on the unpack() part) No he doesn't mean that at all. All it means is that minor scuffles have broken out among the spectators. Don't worry about them, batons & water cannon will fix them; you concentrate on the foo

Re: is there a problem on this simple code

2005-03-13 Thread Bengt Richter
On Sun, 13 Mar 2005 10:46:52 -0500, Peter Hansen <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> Sorry for jumping in with a largely irrelevant comment. I didn't look >> at the code, just sought to illustrate the 6/18 thing further, in a kneejerk >> reaction. >> Though BTW FWIW the visual seq

Re: is there a problem on this simple code

2005-03-13 Thread Jan Rienyer Gadil
@ sir Peter so you mean that it is correct (at least on the unpack() part) when i run this program on IDLE , Python 2.3 (enthought edition), nothing is outputted on the shell, until i decide to close the shell, wherein it tells me if i would like to kill a process... import serial import string

Re: is there a problem on this simple code

2005-03-13 Thread Peter Hansen
Dennis Lee Bieber wrote: rx_data1=0 while (rx_data1 != 0x46): rx_data1 = ser.read(1) (rx_command) = unpack('1B', rx_data1) Isn't this unpack rather redundant -- assuming ser.read(1) only reads one byte, then rx_data1 and rx_command would be identical. Brain fart... unpack converts the raw

Re: is there a problem on this simple code

2005-03-13 Thread Peter Hansen
Bengt Richter wrote: Sorry for jumping in with a largely irrelevant comment. I didn't look at the code, just sought to illustrate the 6/18 thing further, in a kneejerk reaction. Though BTW FWIW the visual sequence of glyphs representing the data was more a str output than repr, I guess: >>> repr

Re: is there a problem on this simple code

2005-03-13 Thread jrlen balane
the assembly program for the microcontroller is created by a classmate. he based the protocol for the serial program from a protocol he found in the internet. unfortunately, i can't find the fpdf file, guess i'll just ask him later when he comes back. On 13 Mar 2005 03:28:43 -0800, John Machin <[E

Re: is there a problem on this simple code

2005-03-13 Thread John Machin
jrlen balane wrote: > the hardware is a school project that uses a microcontroller for "light dimming" > the message command "67" will tell the microcontroller (PIC16F877) to > do a command (to control the intensity of a lamp) > the message command "70" should tell the GUI that the microcontroller

Re: is there a problem on this simple code

2005-03-12 Thread jrlen balane
this is not working, what is wrong with this code?? what it "should" do is find first the command "70" then read the remaining 9 bytes once the command was found: rx_data1=0 while (rx_data1 != 0x46): rx_data1 = ser.read(1) (rx_command) = unpack('1B', rx_data1) rc_data2=ser.read(9) (rx_ms

Re: is there a problem on this simple code

2005-03-12 Thread jrlen balane
the hardware is a school project that uses a microcontroller for "light dimming" the message command "67" will tell the microcontroller (PIC16F877) to do a command (to control the intensity of a lamp) the message command "70" should tell the GUI that the microcontroller has started transmitting. th

Re: is there a problem on this simple code

2005-03-12 Thread Bengt Richter
On 12 Mar 2005 20:12:19 -0800, "John Machin" <[EMAIL PROTECTED]> wrote: > >Bengt Richter wrote: >> On 12 Mar 2005 17:35:50 -0800, "John Machin" <[EMAIL PROTECTED]> >wrote: >> >> > >> >[EMAIL PROTECTED] wrote: >> >> >> >> What actually gets transmitted is "C\x01\x02\x10'\x83". >> > >> >No, that's r

Re: is there a problem on this simple code

2005-03-12 Thread [EMAIL PROTECTED]
John Machin wrote: > [EMAIL PROTECTED] wrote: > > > > What actually gets transmitted is "C\x01\x02\x10'\x83". > > No, that's repr(What actually gets transmitted) Drat, I always get burned by that. > > > That's 18 bytes. Is the command supposed to be the ASCII > > characters \x01 or a single byte

Re: is there a problem on this simple code

2005-03-12 Thread John Machin
Bengt Richter wrote: > On 12 Mar 2005 17:35:50 -0800, "John Machin" <[EMAIL PROTECTED]> wrote: > > > > >[EMAIL PROTECTED] wrote: > >> > >> What actually gets transmitted is "C\x01\x02\x10'\x83". > > > >No, that's repr(What actually gets transmitted) > > If so, that's 6 bytes, not 18: > > >>> "C\x

Re: is there a problem on this simple code

2005-03-12 Thread Bengt Richter
On 12 Mar 2005 17:35:50 -0800, "John Machin" <[EMAIL PROTECTED]> wrote: > >[EMAIL PROTECTED] wrote: >> >> What actually gets transmitted is "C\x01\x02\x10'\x83". > >No, that's repr(What actually gets transmitted) If so, that's 6 bytes, not 18: >>> "C\x01\x02\x10'\x83" "C\x01\x02\x10'\x83" >>>

Re: is there a problem on this simple code

2005-03-12 Thread John Machin
[EMAIL PROTECTED] wrote: > > What actually gets transmitted is "C\x01\x02\x10'\x83". No, that's repr(What actually gets transmitted) > That's 18 bytes. Is the command supposed to be the ASCII > characters \x01 or a single byte whose value is 1? For a start, according to the OP's code, the comma

Re: is there a problem on this simple code

2005-03-12 Thread John Machin
jrlen balane *TOP-POSTED*: > On 12 Mar 2005 07:39:31 -0800, Harlin Seritt <[EMAIL PROTECTED]> wrote: > > hah, this code is anything but simple... > > > > -- > > http://mail.python.org/mailman/listinfo/python-list > > > @sir harlin > so you are saying that there is nothing wrong in this simple progr

Re: is there a problem on this simple code

2005-03-12 Thread [EMAIL PROTECTED]
jrlen balane wrote: > basically what the code does is transmit data to a hardware and then > receive data that the hardware will transmit. > > import serial > import string > import time > from struct import * > > > ser = serial.Serial() > > ser.baudrate = 9600 > ser.port = 0 > ser > ser.close() >

Re: is there a problem on this simple code

2005-03-12 Thread jrlen balane
@sir harlin so you are saying that there is nothing wrong in this simple program. On 12 Mar 2005 07:39:31 -0800, Harlin Seritt <[EMAIL PROTECTED]> wrote: > hah, this code is anything but simple... > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/l

Re: is there a problem on this simple code

2005-03-12 Thread Harlin Seritt
hah, this code is anything but simple... -- http://mail.python.org/mailman/listinfo/python-list

is there a problem on this simple code

2005-03-12 Thread jrlen balane
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser = serial.Serial() ser.baudrate = 9600 ser.port = 0 ser ser.close() ser.open() command = 67 message_no = 1 total_da