simulation serin freezes

friis

Senior Member
Hi,
During simulation the pgm stops at serin - as it should. When I fill-in the transmit buffer (correctly formatted) nothing happens except that the transmit buffer is emptied. If I fill-in transmit buffer with nonsens I get the same result. I have tried with different pgms. It used to be, that when the transmit buffer was filled correctly in the serin would execute. Or if I filled the transmit buffer incorrrectly in, I would be informed of this. I have tried to shut down the pgm or the computer, but that changes nothing. I have spent a couple of days on this.
Am I missing something? Can anyone help?
best regards
torben
 

Goeytex

Senior Member
Picaxe Editor 6 or 5 ?

Need to see your code before anyone can offer much more than an educated guess.
 

friis

Senior Member
Hi Goytex,
I attach the pgm, but I doubt that will help. The problem occurs in all my pgms, who have all worked before. It is as if a parameter has gone wrong - or I am overlooking something obvious (to others).
torben
 

Attachments

westaust55

Moderator
Hello friis,

You did not indicate which version of the program editor you are using PE5 or PE6.

With both versions, and your code (with a minor change for ease of my test) worked.

The modification was:
Symbol PreambleByte = "U"
Symbol Somebyte = "G"
so I knew what the preamble characters were for ease of testing

Then when stepping through the code and the pop-up window came up I entered:

"UG",4,5,6,7,8,13,10
13 = carriage return and 10 = line feed

With both PE5 and PE6 when that input was made and clicked on [send] and single stepped through one click per byte it all worked and after several single steps proceeded to subsequent lines of code.

I was going to add a screen shot but as others have been finding recently, continual time-outs are occurring preventing upload of attachments
 

friis

Senior Member
Hi westaust55,
Here is what I entered:

"C.0","n1200",$AA,$C5,1,2,"#",1,97,$5C
and it used to work.
torben
 

friis

Senior Member
Hi Goytex and westaust55,
This is how the following section in the pgm should look:

Symbol RXpin = C.0
Symbol RXbaud = n1200
Symbol PowerOffPin = C.1
'Symbol Poweroffdelay = 100
Symbol PreambleLength = 5
Symbol PreambleByte = $AA
Symbol Somebyte = $C5
Symbol EOMbyte = $5C
Symbol Polynomial = $8C

Sorry for the confusion.
torben
 

westaust55

Moderator
Hello Friis,

I suspect you have changed something. The command:
serin RXpin,RXbaud,(PreambleByte,Somebyte),SatNoRec,DatalengthRec,SatNoRec1,SatNoRec2,CrcRec,EOMbyteRec

expects the RXpin and RXbaud as per of the program line (not to be fetched during execution)
and you correctly have these included in SYMBOL statements:
Symbol RXpin = C.0
Symbol RXbaud = n1200

you then have 8 byte variables"
PreambleByte,Somebyte,SatNoRec,DatalengthRec,SatNoRec1,SatNoRec2,CrcRec,EOMbyteRec

The first two must be specified values as per your symbol statements:
Symbol PreambleByte = $55 or $AA
Symbol Somebyte = $C5 or $C5

a byte variable cannot hold a string of characters, only a single value in the range 0 - 255 (or $0 to $FF)
so trying to input the first two values as:
"C.0","n1200",. . . .
as 3 and 5 characters respectively will not work.

Try without the:
"C.0","n1200",
at the start and see if it works as you intend.


Why are you trying to input a pin number and baud rate first?
You would need more variables in the Serin command to achieve that.

If this were for some reason of flexibility with say other Serin or Serout commands then:
C.0 is a predefined constant with a value of 8
and
n1200 is a predefined constant with a value of 5

to see that try the small program:
b0 = C.0
w2 =n1200
pause 1000
 

Goeytex

Senior Member
Hi Torben,

The simulator works fine. You must enter what the code expects into the terminal transmit buffer. Set the format to "Raw" then enter:

$55,$C5,1,1,1,1,1,1

Change the 6 bytes as needed for testing your code.
 

Attachments

friis

Senior Member
Hi westaust55,
If I skip "C.0","n1200", the pgm wont compile. But remember, that the pgm (and its "colleagues") used to simulate fine.
The little pgm runs fine.
torben
 

friis

Senior Member
Hi Goytex,
I did as you wrote, but the result is the same: the buffer is emptied, but serin does not execute - nothing happens.
Remember that this pgm had run the simulation before with

"C.0","n1200",$55,$C5,1,2,"#",1,146,$5C

in the buffer.
Something has happened to the pgm (unlikely since it compiles OK) or something has happened to the simulator (I have tried to shut the computer down and restarted).
I cant see that I can do anything else but start the simulation and fill-in the buffer when the pgm stops at the serin and send it off.
Have you tried to compile while omitting the "C.0","n1200"? my pgm wont.
Or - god forbid - have I forgotten something?
torben
 

friis

Senior Member
Hi Goytex,
I tried use $55,$C5,1,2,"#",1,146,$5C in the buffer. The buffer is emptied, but the serin does not execute. The pgm used to simulate fine with
"C.0","n1200",$55,$C5,1,2,"#",1,146,$5C
in the buffer.
Something is wrong with the simulator (I have restarted the computer and the pgm compiles OK). I still ask myself if I have forgotten something.
Can you compile without "C.0","n1200"?
torben
 

hippy

Technical Support
Staff member
If I skip "C.0","n1200", the pgm wont compile. But remember, that the pgm (and its "colleagues") used to simulate fine.
I think there is some confusion here. You need to include the pin name and baud rate in the PICAXE program -

SERIN C.0, N1200, ...

You do not need to send the pin name or baud rate when using the Terminal buffer.
 

Goeytex

Senior Member
Just for clarity ...

I loaded the program attached by Torben with no changes whatsoever. Then ran the simulator exactly as I indicated in my previous post. It works as expected.
 

westaust55

Moderator
Yes that would be correct Goey.
As I earlier (post8) and hippy above (post 13) has stated, there is no value in sending the pin and baudrate data.

However, as the next two values (when transmitted correctly) are the qualifiers,
The pin and baud values/strings are just ignored.
Once two valid consecutive qualifier bytes are received then the following data is accepted.

In summary I omitted the pin and baudrate data and with both PE5 and PE6 the program was working for me so not seen as a PE problem.
 
Last edited:

friis

Senior Member
I Goeytex and westaust55,
The problem is, that nothing happens except that the buffer is emptied when I press "Send". Where does it go?
The simulator has worked before with the same pgms. I have tried to reinstall Picaxe editor.
torben
 

hippy

Technical Support
Staff member
However, as the next two values (when transmitted correctly) are the qualifiers,
The pin and baud values/strings are just ignored.
Once two valid consecutive qualifier bytes are received then the following data is accepted.
You are correct. I tested this code -

Code:
Do
  SerIn C.0, N1200, ($AA,$A5), b1,b2,b3
  SerTxd( "b1=",#b1, TAB, "b2=",#b2, TAB, "b3=",#b3 ,CR,LF )
Loop
And that works as expected under PE6 with Terminal entry in Raw mode of -

$AA,$A5,1,2,3

And -

"C.0","N1200",$AA,$A5,4,5,6

Combined with what Goeytex reports - that fris's program simulates as expected for him, it would seem that the issue is not with PE6 or simulation per se but not sure what it may be.
 

westaust55

Moderator
I Goeytex and westaust55,
The problem is, that nothing happens except that the buffer is emptied when I press "Send". Where does it go?
The simulator has worked before with the same pgms. I have tried to reinstall Picaxe editor.
torben
Are you running the PE simulator in free running or single step mode?
In single step mode you need to click on the step/advance button once for each variable/value that was sent.
 

friis

Senior Member
Hi hippy and westaust55,
I am running it free running. I simply start the simulation and wait for it to stop at serin. Even if I input nonsense, it just empties the buffer. As I said, I re-installed the PE6, that did'nt help.
torben
 

hippy

Technical Support
Staff member
I am running it free running. I simply start the simulation and wait for it to stop at serin. Even if I input nonsense, it just empties the buffer.
That would suggest that whatever is being entered into the buffer and sent does not match what the SERIN is expecting. When that happens PE6 keeps asking for data until it does get something which matches what the SERIN is expecting.

I would guess that the data entered into the buffer and sent does not match the the SERIN qualifiers.

Assuming you are entering what you should be entering, the most likely cause would seem to be that you have ASCII mode selected and not RAW mode for the Terminal window. Ensure RAW mode is selected.

As I said, I re-installed the PE6, that did'nt help.
That won't help.
 

hippy

Technical Support
Staff member
Here is what I entered:

"C.0","n1200",$AA,$C5,1,2,"#",1,97,$5C
and it used to work.
Remember that this pgm had run the simulation before with

"C.0","n1200",$55,$C5,1,2,"#",1,146,$5C
Both may have worked in the past, but what you are entering now has to match what the program is expecting.

It's not clear what your code is expecting as you have posted conflicting information on that.
 
Top