Use qualifier with 20m2 hserin??

jims

Senior Member
Can I use a qualifier with the Hserin command on a 20m2? The syntex check doesn't like this. What's wrong? JimS

Code:
 HSerIn w1 ,2 {,(5)}    'Put hserin data byte into W1.
 

srnet

Senior Member
Syntax (X2 parts):
HSERIN spaddress, count {,(qualifier)}
HSERIN [timeout, address], spaddress, count {,(qualifier)}

Syntax (M2 parts):
HSERIN var
 

Goeytex

Senior Member
Jim,

Hserin on M2 Chips can only receive 2 bytes before the receive buffer is full. Any further bytes will overwrite the current bytes in the buffer. This means that the bytes must be processed (Moved to another variable) before any further bytes can be received.

You can receive two bytes, process them, then receive two more. But the device sending the data must wait long enough between sending byte pairs for the previous bytes to be processed. The first two bytes can be used as a "qualifier" in code with an IF statement.

Personally I have found no practical use for HESERIN on M2 parts.
 

jims

Senior Member
Changed to a 20X2 & trying to use this code . It works OK without the qualifier. What am I doing wrong?? Thank you, JimS

Code:
'*************************************************
'* Picaxe 20x2 uses hserin with qualifier and
'* select case to turn B.7 high (ON) or low (OFF).
'*************************************************

symbol rcv_data=b1

#picaxe 20x2
SetFreq M8
HSerSetup B9600_8, %000 'Setup baud 9600 @ 8Mhz
' "H" = 72  "L" =76 .
main:
Do
 
 	Do
    	 HSerIn 0,1 {,("A")}     'Put hserin data Into s pad "0".
       w4=@ptr   
      Loop Until w1 <> $FF     'Wait for data in.
      Select Case w4
       Case "H" : High B.7 'If data is H then high B.7
       Case "L" : Low  B.7 'If data is L then low B.7.
      End Select
	Loop
 
Last edited:

hippy

Technical Support
Staff member
Code:
 	Do
    	 HSerIn 0,1 {,("A")}     'Put hserin data Into s pad "0".
       w4=@ptr   
      Loop Until w1 <> $FF     'Wait for data in.
w4 and w1
 

jims

Senior Member
Code:
 	Do
    	 HSerIn 0,1 {,("A")}     'Put hserin data Into s pad "0".
       w4=@ptr   
      Loop Until w1 <> $FF     'Wait for data in.
w4 and w1
Thank you Hippy....The PE6 syntax checker doesn't like this statement with the qualifier. When I comment out the qualifier portion it is OK & the code runs on the simulator. JimS
Code:
HSerIn 0,1 '{,("A")}     'Put hserin data Into s pad "0"
 

srnet

Senior Member
Try it without the curly brackets.

Curly brackets, in the manual, indicate and optional item.
 
Top