News:

;) This forum is the property of Proton software developers

Main Menu

CASE

Started by tolyan249, Today at 05:33 AM

Previous topic - Next topic

tolyan249

An example from the old Proton, it complains about the colon — how should it be written correctly?
Thank you.


  Select TMR2             
        Case  20 To 50 : Prinimaem.7 = 0       
        Case  57 To 92 : Prinimaem.7 = 1     
        Case Else      : GoTo scan_vhoda_priemnika   
 End Select

 Returns an error:     
Colon not allowed after Case

Frizie

As the error sais: colon not allowed, so change it to:

Select TMR2           
Case  20 To 50
    Prinimaem.7 = 0     
Case  57 To 92
    Prinimaem.7 = 1   
Case Else
    GoTo scan_vhoda_priemnika 
End Select


Ohm sweet Ohm | www.picbasic.nl

tolyan249

#2
Thank you, I did it like that, but it doesn't work. I upload it, there's no error, but physically it doesn't work — it works 1–2 times and that's it. It feels like the pulse width selection can't be determined via CASE. I upload the old hex file from the old proton — it works.
The only changes are in select TMR2 — what's written above.

tolyan249

Strange, I compiled the same code in the old proton and Positron, and the results are completely different.
The code that was compiled in the old proton, even with these changes, works great; but if I compile it in Positron, it doesn't work.
It's unclear.

John Lawton

Your syntax is still incorrect, look at the manual:

Select Expression
 
  Case Condition(s)
     Instructions 
  {
  Case Condition(s)
     Instructions 
 
  Case Else
     Statement(s)
        }
EndSelect

EndSelect is one word, no spaces.

Been there, done that myself!

John
-----------------------------------------------------------------------------------------
Amicus 8 and 16A/16B dev boards
Especially created for Positron development
https://www.easy-driver.co.uk/Amicus

tolyan249

#5
 John thank you for your help, it's working now.