Serial conflict problem?
kkibbe
Posts: 11
Here below is some simple code that starts my program taken from examples for the most part. I have a max3232 chip on pins 3 and 4 of the prop that receives serial data from outside. I then send the rx'd data to the lcd on pin 7. All good so far. I am having some trouble when I try to tx to my device on the max3232 port and I can't help but think it is some sort of a conflict in software between the two OBJ's I have, lcd and uart.
When I change the value of MODE on the uart OBJ it will crash the display of the lcd before the code even tries to rx on the max3232. I get a bunch of garbage on the lcd display in other words.
Do I have to start a cog or something of that sort? These two objects seam to clash somehow.
Kevin
[noparse][[/noparse]code]CON
_clkmode = xtal1 + pll16x ' use crystal x 16
_xinfreq = 5_000_000 ' 5 MHz cyrstal (sys clock = 80 MHz)
LCD_PIN = 7
LCD_BAUD = 9600
LCD_LINES = 4
OBJ
lcd : "FullDuplexSerialPlus1"
uart : "FullDuplexSerialPlus"
PUB main
uart.start(3, 4, 0, 9600)
lcd.start(24, LCD_PIN, 0, LCD_BAUD)
lcd.tx(22)
lcd.tx(17)
lcd.tx(12)
lcd.str(string("Hello World"))/[noparse][[/noparse]code]
Post Edited (kkibbe) : 4/9/2009 4:05:08 PM GMT
When I change the value of MODE on the uart OBJ it will crash the display of the lcd before the code even tries to rx on the max3232. I get a bunch of garbage on the lcd display in other words.
Do I have to start a cog or something of that sort? These two objects seam to clash somehow.
Kevin
[noparse][[/noparse]code]CON
_clkmode = xtal1 + pll16x ' use crystal x 16
_xinfreq = 5_000_000 ' 5 MHz cyrstal (sys clock = 80 MHz)
LCD_PIN = 7
LCD_BAUD = 9600
LCD_LINES = 4
OBJ
lcd : "FullDuplexSerialPlus1"
uart : "FullDuplexSerialPlus"
PUB main
uart.start(3, 4, 0, 9600)
lcd.start(24, LCD_PIN, 0, LCD_BAUD)
lcd.tx(22)
lcd.tx(17)
lcd.tx(12)
lcd.str(string("Hello World"))/[noparse][[/noparse]code]
Post Edited (kkibbe) : 4/9/2009 4:05:08 PM GMT
Comments
What's "FullDuplexSerialPlus1"?
By MODE I mean as in the third variable below
start(rxpin, txpin, mode, baudrate)
And the "FullDuplexSerialPlus1" is the same object as the one without the "1" on the end. I have two copies of the same code with a different name...
Kevin
2) Again, what do you mean by "change the value of MODE"? The mode parameter is supplied as a constant in your program. Are you changing the source code and recompiling or does your program somehow execute another call to "start"?
You only posted code related to the LCD .
Post some more code related to the max3232.
I was playing with the value of the mode, before compiling to see if my com problems were with the polarity of the tx/rx pins. Then I see that when I change the mode polarity of the uart it somehow changes something on the lcd side.
My prop is attempting to talk with a piece of hardware. I know that a three pin, rx,tx,and gnd is enough for the prop to talk with the device as my pc does the same. Now I am trying to get the prop to talk with the device. I have a storage scope, I can see what is happening on the serial port. The prop sends a series of characters gets some back, responds back and forth but after a bit the prop hangs up and stops... Based on what is happening with the mode change I have a feeling that it might have been a problem with the software of the two objects conflicting be perhaps it lies elsewhere in my code.
Thanks for the pointer on the best use of the object source.
Kevin
Lots of people post problems / questions. The answer to their problem rarely lies in the Propeller itself or the code that comes with the Propeller Tool or from the Object Exchange. It may lie in how they've connected things together or in the code they've written. It's always better to post a diagram of your setup and a full copy of your source code (as an attachment to a message ... please ... not using cut and paste ... that gets rearranged by the forum software and all the indenting is lost). It also helps to provide examples of what works or doesn't work and an explanation of what you're trying to do. Think about who's reading your message. Are you communicating adequately?
What you've posted should display the "Hello World" message. There's no way to explain what else is going on without a lot more information from you.
Post Edited (Mike Green) : 4/9/2009 4:52:31 PM GMT