Need help setting up a New Cog for method.
JMLStamp2p
Posts: 259
Please see attached "Spin" file.
This·is a working code model and is well documented.
I would like to have my "Recieved_Data" method running in a new cog by itself.
The reason for this is because I am sending data back and forth between two Props via an "RF" link. The Data being sent is first entered by a Keypad and therefore the need for Entering data and recieving at the same time is nessessary. I have tried going over the examples in the Prop manual and running them but wen I compile the code the LCD does not work properly.
Need an example code fragment to accomplish this.
Thanks,
JMLStamp2p
This·is a working code model and is well documented.
I would like to have my "Recieved_Data" method running in a new cog by itself.
The reason for this is because I am sending data back and forth between two Props via an "RF" link. The Data being sent is first entered by a Keypad and therefore the need for Entering data and recieving at the same time is nessessary. I have tried going over the examples in the Prop manual and running them but wen I compile the code the LCD does not work properly.
Need an example code fragment to accomplish this.
Thanks,
JMLStamp2p
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
stevenmess, Thank You for your help !
The Spin file attached is working properly, the only thing that I really need help on is to have my "rxStr" method running in a seperate Cog. I my notes above I had said that Reiceved_Data
method needed this. I remembered a post from Mike Green and decided that I should probally leave Cog "0" running in an endless loop at the bottom of "Main" code and run rxStr in a seperate Cog instead.
The reason for this is that I need to recieve data through the Tranceiver and use the Keypad at the same time.
Thanks for your help guys, this project is very Important as it is a pilot project to use Parallax
devices in our Plant. We usually spend around $2,000.00 a month on "Small" electronic devices
for buget purposes :>)
Thanks,
JMLStamp2p
Thanks,
JMLStamp2p
JMLStamp2p
PUB Main : Success | Value
'
' Set up Communications in different Ports and Initialize LCD.
'
data.Stop
data.start(1,0,%0010,9600)
'Set up new Cog "#1" to handle Tranceiver calls.
data_LCD.Stop
data_LCD.start(3,2,0,19200)
'Set up new Cog "#2" to handle LCD calls.
LCD_Setup
'Set up the default display screen for the LCD, via Cog "0".
'
'Process Initial Value of "Global Timer varibles via Keypad input.
'Show them on the LCD, Transmit them to the Remote Prop and then wiat
'for Recieved Data for "Global Timer varible change".
'
rxStr(9,@datain)
'Get 3 sets of "3 digit" numbers from the Keypad, via Cog "0".
'Means the Program is haulting for input here.
Handle_Number_1(@datain)
Handle_Number_2(@datain)
Handle_Number_3(@datain)
'Do number conversion for "Global" Timer varibles, via Cog "0".
Print_Status_to_LCD
'Print "Global" Timer varibles to the LCD via Cog "0".
Transmit_Timer_values(@datain)
'Transmit Numbers entered via Keypad out the Port to the Remote Prop.
repeat
Recieved_Data(9,@datain)
'Wait for more Received Data which is a new Value for the Global Timer
'varibles, writes them to the "datain" Array.
Print_Status_to_LCD
'NOTE: At this point in the program I need to have access to input
'another set of numbers via the Keypad to Transmit back to the Remote
'Prop. Since Cog "0" is in a repeat loop here I assume that I need to
'have rxStr running in a seperate Process.
'Need help via example code.
The following code is running in the receiver Prop. I can send 3 sets of 3 digit numbers from the tranmitter and it will show up perfect every time on the receive end. When I try and adjust this code to to use rxStr "see attached file" The receiver props LCD will show the first digit that I·had sent·and the rest will be "0's".
JMLStamp2p
PUB Main
·data.Stop·············
·data.start(1,0,%0010,9600)
·data_LCD.Stop
·data_LCD.start(3,2,0,19200)
·LCD_Setup·
·Recieved_Data(9, @datain)
·Print_Status_to_LCD
·Main
& Print_Status_to_LCD. The latter just reads and writes the array bytes to the LCD. I am suspicious that the problem may be in my rxStr Method coding. I'm going over and over it ...
JMLStamp2p
Edit: this is for the recieve cde.
Also, this code
Is calling main which could be a problem.
I think there may be more but this is a start.
Post Edited (stevenmess2004) : 3/9/2008 4:20:51 AM GMT
Thank You for your advice and examples, they are always helpful to me. Would you please take a look at my latest post, it is to the forum adminastrators attention but was not meant to be exclussively to him. It has my complete Transmitter and Receiver code posted in two seperate files with complete comments and should be easier to understand.
Thanks so much for your help, it is appreciated more than you know !
JMLStamp2p
PS: How do you install your replys in the grayed out box with Blue text as above ?
JMLStamp2p