serin of data
Archiver
Posts: 46,084
Hi all,
I have almost got my BSII talking to my PIC16F84 using serial communication ! I
can get the BSII to send a message, the PIC to receive, the PIC to send.... and
this is where I have a problem. For some reason I can't get the BSII is not
receiving the byte from the PIC properly. I have a feeling it is something to do
with using the right serin modifiers?
I know that the PIC is outputting the right data because if I attach the PIC to
a terminal program on my PC I see a stream of 'A's ( The PIC should be sending
the byte '65' or in ASCII 'A' )
When I print the received character out using debug for the stamp I usually get
"Error! 208" in my debug window. (see code below for details). Very occationally
it will work correctly the first time and I will get "PIC Response 65" then
every loop after that will be the same error as above.
I have attached my code below, can anyone see what I am doing wrong?
I also had the serin timeout set as I want to use this in my final code, but I
took this out as it just kept jumping to the noData routine :-(
Thanks so much for any assistance!
regards,
James Fitzsimons
' James Fitzsimons
' 14/8/01
'
' Communications test code
' This code is designed to test serial coms with a PIC 16F84
' The PIC has no hardware UART and so is using software UART.
' Eventual code will be integrated with main robot code to enable
' seperate motor and encoder control by PIC, via commands from
' BSII over serial link.
' This test code will send a message to the PIC requesting that
' an LED is toggled. This will happen every 5 seconds. The PIC
' will respond to say that the LED has been toggled.
' Constants
SPKR con 15 'Speaker port address
SERIALOUT con 1
SERIALIN con 2
TIMEOUT con 1000
waitTimer con 2000
' variables
incoming var byte
outgoing var byte
incoming = 0
outgoing = 65
main:
outgoing = 65
incoming = 0
'freqout SPKR,250,2000,4000 ' test to check it is looping
debug "loop!",cr
gosub send ' main flow simply sends message to toggle LED
gosub receive ' receives the response from the PIC
gosub wait5secs ' waits for 5 seconds then repeats
goto main
'=====================
' send:
' simply sends byte 'outgoing' at 1200 baud, no stop bit, no parity
'=====================
send:
debug "send",cr
serout SERIALOUT,813,[noparse][[/noparse]outgoing]
return
'=====================
'receive:
' receives byte 'incoming' at 1200 baud. If
' error occurs, prints error and returns to
' main to resend.
'=====================
receive:
'debug "recieve",cr
serin SERIALIN,813,[noparse][[/noparse]incoming] 'TIMEOUT,noData,[noparse][[/noparse]incoming]
if incoming <> outgoing then print_error
debug "PIC Response ",DEC incoming,cr
return
'=====================
'noData
' prints noData message and returns to main loop
'=====================
noData:
debug "No Data! ",cr
gosub wait5secs
goto main
'=====================
'print_error
' prints error and returns to main loop
'=====================
print_error:
debug "Error! ",DEC incoming,cr
gosub wait5secs
goto main
'=====================
'wait5secs
' pauses for 5 seconds and returns.
'=====================
wait5secs:
pause waitTimer
return
end
[noparse][[/noparse]Non-text portions of this message have been removed]
I have almost got my BSII talking to my PIC16F84 using serial communication ! I
can get the BSII to send a message, the PIC to receive, the PIC to send.... and
this is where I have a problem. For some reason I can't get the BSII is not
receiving the byte from the PIC properly. I have a feeling it is something to do
with using the right serin modifiers?
I know that the PIC is outputting the right data because if I attach the PIC to
a terminal program on my PC I see a stream of 'A's ( The PIC should be sending
the byte '65' or in ASCII 'A' )
When I print the received character out using debug for the stamp I usually get
"Error! 208" in my debug window. (see code below for details). Very occationally
it will work correctly the first time and I will get "PIC Response 65" then
every loop after that will be the same error as above.
I have attached my code below, can anyone see what I am doing wrong?
I also had the serin timeout set as I want to use this in my final code, but I
took this out as it just kept jumping to the noData routine :-(
Thanks so much for any assistance!
regards,
James Fitzsimons
' James Fitzsimons
' 14/8/01
'
' Communications test code
' This code is designed to test serial coms with a PIC 16F84
' The PIC has no hardware UART and so is using software UART.
' Eventual code will be integrated with main robot code to enable
' seperate motor and encoder control by PIC, via commands from
' BSII over serial link.
' This test code will send a message to the PIC requesting that
' an LED is toggled. This will happen every 5 seconds. The PIC
' will respond to say that the LED has been toggled.
' Constants
SPKR con 15 'Speaker port address
SERIALOUT con 1
SERIALIN con 2
TIMEOUT con 1000
waitTimer con 2000
' variables
incoming var byte
outgoing var byte
incoming = 0
outgoing = 65
main:
outgoing = 65
incoming = 0
'freqout SPKR,250,2000,4000 ' test to check it is looping
debug "loop!",cr
gosub send ' main flow simply sends message to toggle LED
gosub receive ' receives the response from the PIC
gosub wait5secs ' waits for 5 seconds then repeats
goto main
'=====================
' send:
' simply sends byte 'outgoing' at 1200 baud, no stop bit, no parity
'=====================
send:
debug "send",cr
serout SERIALOUT,813,[noparse][[/noparse]outgoing]
return
'=====================
'receive:
' receives byte 'incoming' at 1200 baud. If
' error occurs, prints error and returns to
' main to resend.
'=====================
receive:
'debug "recieve",cr
serin SERIALIN,813,[noparse][[/noparse]incoming] 'TIMEOUT,noData,[noparse][[/noparse]incoming]
if incoming <> outgoing then print_error
debug "PIC Response ",DEC incoming,cr
return
'=====================
'noData
' prints noData message and returns to main loop
'=====================
noData:
debug "No Data! ",cr
gosub wait5secs
goto main
'=====================
'print_error
' prints error and returns to main loop
'=====================
print_error:
debug "Error! ",DEC incoming,cr
gosub wait5secs
goto main
'=====================
'wait5secs
' pauses for 5 seconds and returns.
'=====================
wait5secs:
pause waitTimer
return
end
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
Does the PIC have a delay after it receives a character, before it
sends the response? The stamp requires several milliseconds to
execute all the returns and gosubs, before it is ready to receive the
data with the serin.
The 813 baudmode is 1200 baud, 1 stop bit, noninverted (rests at a
high level, goes low for the start bit and "1" bits). Is that what
you want?
-- regards,
Tracy Allen
electronically monitored ecosystems
mailto:tracy@e...
http://www.emesystems.com
You say in your comment at send:
1200 baud, no stop bit, no parity.
The stamp does send out a stop bit and also expects one using serin.
I hope your pic serout does send out a stop bit.
You use the constant 813 which is for 1200 baud true polarity for the bs2
and bs2e.
You say when you connect the pic to a pc you receive the A's.
The pc uses invert logic (12V=0 -12V=1)
Did you try to use the constant 17197 for 1200 baud inverted?
Hope this helps
Regards peter
Oorspronkelijk bericht
Van: James Fitzsimons [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=2HP9kokAFMlyrwsNbZJqA0Z9-lpWhBXXzUZWSKN-YqqRjcoxruo9wAAfRHyRRXatvXfoGDrU2RpbsMuGky1p]jamesfit@p...[/url
Verzonden: donderdag 15 november 2001 1:58
Aan: basicstamps@yahoogroups.com
Onderwerp: [noparse][[/noparse]basicstamps] serin of data
Hi all,
I have almost got my BSII talking to my PIC16F84 using serial communication
! I can get the BSII to send a message, the PIC to receive, the PIC to
send.... and this is where I have a problem. For some reason I can't get the
BSII is not receiving the byte from the PIC properly. I have a feeling it is
something to do with using the right serin modifiers?
I know that the PIC is outputting the right data because if I attach the PIC
to a terminal program on my PC I see a stream of 'A's ( The PIC should be
sending the byte '65' or in ASCII 'A' )
When I print the received character out using debug for the stamp I usually
get "Error! 208" in my debug window. (see code below for details). Very
occationally it will work correctly the first time and I will get "PIC
Response 65" then every loop after that will be the same error as above.
I have attached my code below, can anyone see what I am doing wrong?
I also had the serin timeout set as I want to use this in my final code, but
I took this out as it just kept jumping to the noData routine :-(
Thanks so much for any assistance!
regards,
James Fitzsimons
' James Fitzsimons
' 14/8/01
'
' Communications test code
' This code is designed to test serial coms with a PIC 16F84
' The PIC has no hardware UART and so is using software UART.
' Eventual code will be integrated with main robot code to enable
' seperate motor and encoder control by PIC, via commands from
' BSII over serial link.
' This test code will send a message to the PIC requesting that
' an LED is toggled. This will happen every 5 seconds. The PIC
' will respond to say that the LED has been toggled.
' Constants
SPKR con 15 'Speaker port address
SERIALOUT con 1
SERIALIN con 2
TIMEOUT con 1000
waitTimer con 2000
' variables
incoming var byte
outgoing var byte
incoming = 0
outgoing = 65
main:
outgoing = 65
incoming = 0
'freqout SPKR,250,2000,4000 ' test to check it is looping
debug "loop!",cr
gosub send ' main flow simply sends message to toggle LED
gosub receive ' receives the response from the PIC
gosub wait5secs ' waits for 5 seconds then repeats
goto main
'=====================
' send:
' simply sends byte 'outgoing' at 1200 baud, no stop bit, no parity
'=====================
send:
debug "send",cr
serout SERIALOUT,813,[noparse][[/noparse]outgoing]
return
'=====================
'receive:
' receives byte 'incoming' at 1200 baud. If
' error occurs, prints error and returns to
' main to resend.
'=====================
receive:
'debug "recieve",cr
serin SERIALIN,813,[noparse][[/noparse]incoming] 'TIMEOUT,noData,[noparse][[/noparse]incoming]
if incoming <> outgoing then print_error
debug "PIC Response ",DEC incoming,cr
return
'=====================
'noData
' prints noData message and returns to main loop
'=====================
noData:
debug "No Data! ",cr
gosub wait5secs
goto main
'=====================
'print_error
' prints error and returns to main loop
'=====================
print_error:
debug "Error! ",DEC incoming,cr
gosub wait5secs
goto main
'=====================
'wait5secs
' pauses for 5 seconds and returns.
'=====================
wait5secs:
pause waitTimer
return
end
[noparse][[/noparse]Non-text portions of this message have been removed]
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
firstly thanks very much for your responses!
Peter wrote:
> You say in your comment at send:
> 1200 baud, no stop bit, no parity.
> The stamp does send out a stop bit and also expects one using serin.
> I hope your pic serout does send out a stop bit.
Yes the PIC is using sending the stop bit... this is a classic example of
changing the code and not updating the comments ;-)
The comment should be "1200 baud, 1 stop bit, no parity"
Tracy wrote:
> The 813 baudmode is 1200 baud, 1 stop bit, noninverted (rests at a
> high level, goes low for the start bit and "1" bits). Is that what
> you want?
Yes. I have tested the communications of both the BSII and the PIC connected to
my PC through MAX232 and a terminal program. They both seem to send and receive
data from the terminal program correctly.
Tracy wrote:
> Does the PIC have a delay after it receives a character, before it
> sends the response? The stamp requires several milliseconds to
> execute all the returns and gosubs, before it is ready to receive the
> data with the serin.
This is possibly the problem... the PIC may be responding to quickly. I will
have to insert a delay from the PIC end and see if this helps. Would 3-4ms be
enough?
Peter wrote:
> You say when you connect the pic to a pc you receive the A's.
> The pc uses invert logic (12V=0 -12V=1)
> Did you try to use the constant 17197 for 1200 baud inverted?
Ah... I would I am connecting the PIC to the PC through a MAX232, however I am
connecting the PIC output pin directly to the BSII imput pin so I shouldn't
have to adjust this should I? I haven't tried the 17197 constant yet though,
something to do when I get home from work!
Thanks so much for any advice,
regards,
James Fitzsimons
finished an Atmel AVR-based design I was working on and it had the
same problem. The PC would get the data fine, but the stamp would
always miss the data. I found that the Stamp2 needed a 1mS delay in
order to recieve the data. The AVR would respond within about 20uS
of recieving the bytewhich was too fast. I made it 2mS just to be
safe. The actual delay may depend on the speed of your PIC, though
for my AVR at 8MHz, the absolute minimum was around 800uS.
--- In basicstamps@y..., jamesfit@p... wrote:
> Hi Peter and Tracy,
> firstly thanks very much for your responses!
>
> Peter wrote:
> > You say in your comment at send:
> > 1200 baud, no stop bit, no parity.
> > The stamp does send out a stop bit and also expects one using
serin.
> > I hope your pic serout does send out a stop bit.
>
> Yes the PIC is using sending the stop bit... this is a classic
example of
> changing the code and not updating the comments ;-)
> The comment should be "1200 baud, 1 stop bit, no parity"
>
> Tracy wrote:
> > The 813 baudmode is 1200 baud, 1 stop bit, noninverted (rests at
a
> > high level, goes low for the start bit and "1" bits). Is that
what
> > you want?
>
> Yes. I have tested the communications of both the BSII and the PIC
connected to
> my PC through MAX232 and a terminal program. They both seem to
send and receive
> data from the terminal program correctly.
>
> Tracy wrote:
> > Does the PIC have a delay after it receives a character, before
it
> > sends the response? The stamp requires several milliseconds to
> > execute all the returns and gosubs, before it is ready to
receive the
> > data with the serin.
>
> This is possibly the problem... the PIC may be responding to
quickly. I will
> have to insert a delay from the PIC end and see if this helps.
Would 3-4ms be
> enough?
>
> Peter wrote:
> > You say when you connect the pic to a pc you receive the A's.
> > The pc uses invert logic (12V=0 -12V=1)
> > Did you try to use the constant 17197 for 1200 baud inverted?
>
> Ah... I would I am connecting the PIC to the PC through a MAX232,
however I am
> connecting the PIC output pin directly to the BSII imput pin so I
shouldn't
> have to adjust this should I? I haven't tried the 17197 constant
yet though,
> something to do when I get home from work!
>
> Thanks so much for any advice,
> regards,
> James Fitzsimons
variable (incoming) is before the timeout I dont think this will work. At
least I have never tried it that way
On Thu, 15 Nov 2001 22:58:04 +1300 "James Fitzsimons"
<jamesfit@p...> writes:
> Hi all,
> I have almost got my BSII talking to my PIC16F84 using serial
> communication ! I can get the BSII to send a message, the PIC to
> receive, the PIC to send.... and this is where I have a problem. For
> some reason I can't get the BSII is not receiving the byte from the
> PIC properly. I have a feeling it is something to do with using the
> right serin modifiers?
>
> I know that the PIC is outputting the right data because if I attach
> the PIC to a terminal program on my PC I see a stream of 'A's ( The
> PIC should be sending the byte '65' or in ASCII 'A' )
>
> When I print the received character out using debug for the stamp I
> usually get "Error! 208" in my debug window. (see code below for
> details). Very occationally it will work correctly the first time
> and I will get "PIC Response 65" then every loop after that will be
> the same error as above.
>
> I have attached my code below, can anyone see what I am doing wrong?
>
> I also had the serin timeout set as I want to use this in my final
> code, but I took this out as it just kept jumping to the noData
> routine :-(
>
> Thanks so much for any assistance!
> regards,
> James Fitzsimons
>
> ' James Fitzsimons
>
> ' 14/8/01
>
> '
>
> ' Communications test code
>
> ' This code is designed to test serial coms with a PIC 16F84
>
> ' The PIC has no hardware UART and so is using software UART.
>
> ' Eventual code will be integrated with main robot code to enable
>
> ' seperate motor and encoder control by PIC, via commands from
>
> ' BSII over serial link.
>
> ' This test code will send a message to the PIC requesting that
>
> ' an LED is toggled. This will happen every 5 seconds. The PIC
>
> ' will respond to say that the LED has been toggled.
>
> ' Constants
>
> SPKR con 15 'Speaker port address
>
> SERIALOUT con 1
>
> SERIALIN con 2
>
> TIMEOUT con 1000
>
> waitTimer con 2000
>
> ' variables
>
> incoming var byte
>
> outgoing var byte
>
> incoming = 0
>
> outgoing = 65
>
> main:
>
> outgoing = 65
>
> incoming = 0
>
> 'freqout SPKR,250,2000,4000 ' test to check it is looping
>
> debug "loop!",cr
>
> gosub send ' main flow simply sends message to toggle LED
>
> gosub receive ' receives the response from the PIC
>
> gosub wait5secs ' waits for 5 seconds then repeats
>
> goto main
>
> '=====================
>
> ' send:
>
> ' simply sends byte 'outgoing' at 1200 baud, no stop bit, no parity
>
> '=====================
>
> send:
>
> debug "send",cr
>
> serout SERIALOUT,813,[noparse][[/noparse]outgoing]
>
> return
>
> '=====================
>
> 'receive:
>
> ' receives byte 'incoming' at 1200 baud. If
>
> ' error occurs, prints error and returns to
>
> ' main to resend.
>
> '=====================
>
> receive:
>
> 'debug "recieve",cr
>
> serin SERIALIN,813,[noparse][[/noparse]incoming] 'TIMEOUT,noData,[noparse][[/noparse]incoming]
>
> if incoming <> outgoing then print_error
>
> debug "PIC Response ",DEC incoming,cr
>
> return
>
> '=====================
>
> 'noData
>
> ' prints noData message and returns to main loop
>
> '=====================
>
> noData:
>
> debug "No Data! ",cr
>
> gosub wait5secs
>
> goto main
>
>
>
> '=====================
>
> 'print_error
>
> ' prints error and returns to main loop
>
> '=====================
>
> print_error:
>
> debug "Error! ",DEC incoming,cr
>
> gosub wait5secs
>
> goto main
>
> '=====================
>
> 'wait5secs
>
> ' pauses for 5 seconds and returns.
>
> '=====================
>
> wait5secs:
>
> pause waitTimer
>
> return
>
> end
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
Timout.
Did you change the port assignments for separate input,output.
If all that is ok the problem has to be the line between the stamp and
the pic.
Use a logic probe on the pins to see if data is present.
PS. If you dont have one get one. (very helpful)
On Thu, 15 Nov 2001 22:58:04 +1300 "James Fitzsimons"
<jamesfit@p...> writes:
> Hi all,
> I have almost got my BSII talking to my PIC16F84 using serial
> communication ! I can get the BSII to send a message, the PIC to
> receive, the PIC to send.... and this is where I have a problem. For
> some reason I can't get the BSII is not receiving the byte from the
> PIC properly. I have a feeling it is something to do with using the
> right serin modifiers?
>
> I know that the PIC is outputting the right data because if I attach
> the PIC to a terminal program on my PC I see a stream of 'A's ( The
> PIC should be sending the byte '65' or in ASCII 'A' )
>
> When I print the received character out using debug for the stamp I
> usually get "Error! 208" in my debug window. (see code below for
> details). Very occationally it will work correctly the first time
> and I will get "PIC Response 65" then every loop after that will be
> the same error as above.
>
> I have attached my code below, can anyone see what I am doing wrong?
>
> I also had the serin timeout set as I want to use this in my final
> code, but I took this out as it just kept jumping to the noData
> routine :-(
>
> Thanks so much for any assistance!
> regards,
> James Fitzsimons
>
> ' James Fitzsimons
>
> ' 14/8/01
>
> '
>
> ' Communications test code
>
> ' This code is designed to test serial coms with a PIC 16F84
>
> ' The PIC has no hardware UART and so is using software UART.
>
> ' Eventual code will be integrated with main robot code to enable
>
> ' seperate motor and encoder control by PIC, via commands from
>
> ' BSII over serial link.
>
> ' This test code will send a message to the PIC requesting that
>
> ' an LED is toggled. This will happen every 5 seconds. The PIC
>
> ' will respond to say that the LED has been toggled.
>
> ' Constants
>
> SPKR con 15 'Speaker port address
>
> SERIALOUT con 1
>
> SERIALIN con 2
>
> TIMEOUT con 1000
>
> waitTimer con 2000
>
> ' variables
>
> incoming var byte
>
> outgoing var byte
>
> incoming = 0
>
> outgoing = 65
>
> main:
>
> outgoing = 65
>
> incoming = 0
>
> 'freqout SPKR,250,2000,4000 ' test to check it is looping
>
> debug "loop!",cr
>
> gosub send ' main flow simply sends message to toggle LED
>
> gosub receive ' receives the response from the PIC
>
> gosub wait5secs ' waits for 5 seconds then repeats
>
> goto main
>
> '=====================
>
> ' send:
>
> ' simply sends byte 'outgoing' at 1200 baud, no stop bit, no parity
>
> '=====================
>
> send:
>
> debug "send",cr
>
> serout SERIALOUT,813,[noparse][[/noparse]outgoing]
>
> return
>
> '=====================
>
> 'receive:
>
> ' receives byte 'incoming' at 1200 baud. If
>
> ' error occurs, prints error and returns to
>
> ' main to resend.
>
> '=====================
>
> receive:
>
> 'debug "recieve",cr
>
> serin SERIALIN,813,[noparse][[/noparse]incoming] 'TIMEOUT,noData,[noparse][[/noparse]incoming]
>
> if incoming <> outgoing then print_error
>
> debug "PIC Response ",DEC incoming,cr
>
> return
>
> '=====================
>
> 'noData
>
> ' prints noData message and returns to main loop
>
> '=====================
>
> noData:
>
> debug "No Data! ",cr
>
> gosub wait5secs
>
> goto main
>
>
>
> '=====================
>
> 'print_error
>
> ' prints error and returns to main loop
>
> '=====================
>
> print_error:
>
> debug "Error! ",DEC incoming,cr
>
> gosub wait5secs
>
> goto main
>
> '=====================
>
> 'wait5secs
>
> ' pauses for 5 seconds and returns.
>
> '=====================
>
> wait5secs:
>
> pause waitTimer
>
> return
>
> end
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
> Subject and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
If you connected the pic via a max232 the 813 constant should be ok.
Regarding Tracy's remark about delaying; do you pace the output stream from
the pic?
Perhaps you could try letting the pic send out A's continuesly at a certain
pace
and see if the stamp is able to receive them all. Tweak the pace value until
it does.
Regards peter
Oorspronkelijk bericht
Van: jamesfit@p... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=lRwQKQMxMrbAO0tLu-KJWKPs7rgooz5MeMgHuox6BIQHi97E5m385ZtBDkRAyJlcGurO2BhBH1R4UA6dGb8x]jamesfit@p...[/url
Verzonden: donderdag 15 november 2001 11:49
Aan: basicstamps@yahoogroups.com
Onderwerp: Re: [noparse][[/noparse]basicstamps] serin of data
Hi Peter and Tracy,
firstly thanks very much for your responses!
Peter wrote:
> You say in your comment at send:
> 1200 baud, no stop bit, no parity.
> The stamp does send out a stop bit and also expects one using serin.
> I hope your pic serout does send out a stop bit.
Yes the PIC is using sending the stop bit... this is a classic example of
changing the code and not updating the comments ;-)
The comment should be "1200 baud, 1 stop bit, no parity"
Tracy wrote:
> The 813 baudmode is 1200 baud, 1 stop bit, noninverted (rests at a
> high level, goes low for the start bit and "1" bits). Is that what
> you want?
Yes. I have tested the communications of both the BSII and the PIC connected
to
my PC through MAX232 and a terminal program. They both seem to send and
receive
data from the terminal program correctly.
Tracy wrote:
> Does the PIC have a delay after it receives a character, before it
> sends the response? The stamp requires several milliseconds to
> execute all the returns and gosubs, before it is ready to receive the
> data with the serin.
This is possibly the problem... the PIC may be responding to quickly. I will
have to insert a delay from the PIC end and see if this helps. Would 3-4ms
be
enough?
Peter wrote:
> You say when you connect the pic to a pc you receive the A's.
> The pc uses invert logic (12V=0 -12V=1)
> Did you try to use the constant 17197 for 1200 baud inverted?
Ah... I would I am connecting the PIC to the PC through a MAX232, however I
am
connecting the PIC output pin directly to the BSII imput pin so I shouldn't
have to adjust this should I? I haven't tried the 17197 constant yet though,
something to do when I get home from work!
Thanks so much for any advice,
regards,
James Fitzsimons
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
thanks for your response,
> James correct me if im wrong but in the serin line it looks like the
> variable (incoming) is before the timeout I dont think this will work. At
> least I have never tried it that way
this is my bad style! I commented the timeout stuff out and didn't put any
explaination there !
> serin SERIALIN,813,[noparse][[/noparse]incoming] 'TIMEOUT,noData,[noparse][[/noparse]incoming]
If you look carefully you'll see the ' before the timeout....
thanks heaps,
regards,
James Fitzsimons
I just wanted to say thank you to all those on the list that have helped me
out over the last few weeks. I finally got serial communications between my
PIC and BSII working today! The final step in the process was to add a delay
between the PIC receiving the incoming byte from the BSII and sending the
reply. It appears the PIC was sending it's response faster than the BSII
could get ready to receive it.
Well, thanks again. Onwards and upwards ;-)
Regards,
James Fitzsimons