regards
Ralph
_______________________________________________
There are only 10 types of people:
Those who understand binary, and those who don't ...
_______________________________________________
Im sorry for starting two threads but i began the first one in the wrong place and i saw a comment from someone regarding posting in the correct place so i changed it to here, Next the suggestion that you provide me with the completed piece of code was not a serios one as i would have thought the tone of the following statement in the post would have suggested, getting a ready built piece of code is not what i am after at all as this would teach me nothing.
Now in the post that i started in the wrong place there is a picture, this picture shows that i do not wish to use more than one chip.
so i assumed that although related to your method using more than 1 chip that there would be a new set of complexities involved in using 1 chip so i started a new thread. Again if this was not the correct thing to do i am sorry.
i would now like to know where this question has been answered
so that i can read this information and maybe get some use out of the replies
quote:
If i was sending data to a device (nmea) what would be the maximum interval between transmissions before the nmea device detects an error and displays the error or is this not defined in the standard?
i do see similarities between the above question and the one below that has been posted, However it does not answer my question,
quote:
As there is no defined timing between the different talkers
all that aside please forgive me if i have upset anyone.
Now here is my code so far, and although not completed and there are no timeouts yet , being new to this i want to iron out mistakes before the code gets to complicated for me, running before i can walk as it were. I do not mind if i miss some sentances from a pin while i read another unless the recieving device minds the break in information for that particular device, im not sure how long a device can go without update from a particular talker before it objects, which i asked about it in the question above.
If you see anything you dont think is right or you know of a more efficient way of achieving the same thing could you please let me know thanks.
the code:-
' Routine to read imea sentance from a pin and send it
' then do the same from another pin and send it.
testbyte VAR BYTE ' Define byte variable
pinin1 VAR PORTC.1 ' Define serial pinin1 as PORTC.1
pinin2 VAR PORTC.2 ' Define serial pinin2 as PORTC.2
pinout VAR PORTC.7 ' Define serial pinout as PORTC.7
' For these examples, assume that the following string
' is being received continuously at 4800 baud on PORTC.7:
start1:
Serin2 pinin1,188,[testbyte] ' read portc.1
if testbyte = "$" then begin1
goto start1
begin1:
Serout2 pinout,188,[testbyte]
goto loop1
loop1:
Serin2 pinin1,188,[testbyte]
if testbyte = "$" then start2
Serout2 pinout,188,[testbyte]
goto loop1
start2:
Serin2 pinin2,188,[testbyte] ' read portc.2
if testbyte = "$" then begin2 '
goto start2
begin2:
Serout2 pinout,188,[testbyte]
goto loop2
loop2:
Serin2 pinin2,188,[testbyte]
if testbyte = "$"then start1
Serout2 pinout,188,[testbyte]
goto loop2
Last edited by Richardco; - 25th November 2005 at 22:48.
Your code hurts my head and is very hard for me to follow the logic because it jumps in and out so much, so this is the same code rewritten. Is this what you were intending?
start1:
Do
Serin2 pinin1, 188, [testbyte] ' read portc.1
If testbyte = "$" Then
Serout2 pinout, 188, [testbyte]
Do
Serin2 pinin1, 188, [testbyte]
If testbyte = "$" Then
Do
Serin2 pinin2, 188, [testbyte] ' read portc.2
If testbyte = "$" Then
Serout2 pinout, 188, [testbyte]
Do
Serin2 pinin2, 188, [testbyte]
If testbyte = "$" Then start1
Serout2 pinout, 188, [testbyte]
Loop
End If
Loop
Serout2 pinout, 188, [testbyte]
Loop
End If
Loop
Mine would look even better if the indentation could be displayed. With a little luck there will be an attachment here.
You are aware that if you have multiple Serial inputs and the data is randomly arriving from all directions on all pins, whilst you are attending to one, then you will be losing data from the others. I just thought I'd burst your bubble before you get too involved in your project and discover it doesn't work as you expected.
Hi Melanie,
this what I was actually trying to say here
This is yet another example of that it's hard to keep track with two different threads regarding the very same issue in two different forum categories.
regards
Ralph
_______________________________________________
There are only 10 types of people:
Those who understand binary, and those who don't ...
_______________________________________________
Thankyou air1kdf,
that does look a lot easier to understand, i didnt know you could use 'DO' and am now going to read about it in the manual, Its funny because when you look at the code you have written yourself it looks very clear but when someone such as yourself looks at it and puts a new slant on things it seems obvios, But still i have a good excuse " Im still at primary grade where all this is concerned, i do hope that you realise how thankfull people like me are to have people like you to ask.
can i just ask this question about your code: this is just a snippet,
Do
Serin2 pinin1, 188, [testbyte] ' read portc.1
If testbyte = "$" Then
Serout2 pinout, 188, [testbyte]
Do
Serin2 pinin1, 188, [testbyte]
If testbyte = "$" Then
the data is read from pin 1
the data is checked to see if it conformes
if the data conforms the program progresses
if the data does not conform then what happens??
it should keep checking the pin till the data conforms but i cant see this with your piece of code.
i have commented my code now so you can see what i wanted to achieve more easily, and here is a part to read from one pin and move on to the next pin if data is validated and if not to continue checking till it is, i am not sure if i have correctly understood the timeouts (,500,start2,) but ignore them if they are wrong please.
start1:
LOW PORTB.0 ' Reset data led to low
Serin2 pinin1,188,500,start2,[testbyte] ' Read portc.1
if testbyte = "$" then begin1 ' Test Charactor
goto start1 ' Loop till correct
begin1:
LOW PORTB.6 ' Reset data led to low
HIGH PORTB.1 ' Show data found at pin
Serout2 pinout,188,[testbyte] ' Send data out
high PORTB.0 ' Show data is sent out
goto loop1 ' Enter main loop 1
loop1:
Serin2 pinin1,188,500,start2,[testbyte] ' Read portc.1
if testbyte = "$" then start2 ' Test Charactor
Serout2 pinout,188,[testbyte] ' Send data out '
goto loop1 ' Loop till correct
Thankyou for your time once more.
Hi Melanie, ok thankyou for your observation, i am aware of the data that will be missed as im only reading one pin at a time, but i figured that in the time it takes to read the other pins, the data from the other instruments would not of changed that much anyhow, and for instance im chugging along in my little pleasure fishing boat, how far would i have moved in the time it takes to read a pin for the second time?, and the other instruments that will be attached are much the same, there will be a gps, a weather instrument , a sounder and velocity readings. So im HOPING that the missing data will be of no consequence, and untill i try it i will not know. But thankyou anyhow. By the way "I just thought I'd burst your bubble" Sorry that burst the day i realised i would have to work for a livinglol
Ok now here is the question i do not know the answer to if i am mistaken about the missing data.
I can see that the idea of having a pic to recieve data from each talker and a master pic to combine the data and send it out seems logical, However if all the 4 talkers are transmitting a continuous stream of data to thair respective pics at 4800baud, how will the master ever hope to transmit at 4800baud all the data it collects, i cant see how it will do it for long before it gets overloaded. If you can see what i mean? Again if my thinking is not correct please enlighten me because i know very little and i want to learn.
And could someone please delete the other thread i started in the wrong place by mistake (and have said sorry for) as it may confuse some people.
Last edited by Richardco; - 26th November 2005 at 23:29.
Bookmarks