Hi folks,
I have a question concerning the correct use of the SELECT-CASE function.
Because according to the help-file of BASCOM one can use several statements after the CASE, I first tried it this way:
[code:1:bcb7455dd6]
$regfile = "m32def.dat" 'ATMEGA32: 32k Flash, 2k RAM, 1k EEPROM
$framesize = 200
$swstack = 200
$hwstack = 200
$crystal = 16000000 '16 MHz Quarz
Dim Device_mode As Byte
Dim Ist_wert As Single , U_meas As Single , R_meas As Single , P_meas As Single , Last_value_high As Single
Select Case Device_mode
Case 4 : Ist_wert = U_meas : Last_value_high = U_meas
Case 5 : Ist_wert = P_meas : Last_value_high = P_meas
Case 6 : Ist_wert = R_meas : Last_value_high = R_meas
End Select
End
[/code:1:bcb7455dd6]
But this gives a compile error.
When I try it the CASE-statements in the following way, I get no compile errors:
[code:1:bcb7455dd6]
Select Case Device_mode
Case 4
Ist_wert = U_meas : Last_value_high = U_meas
Case 5
Ist_wert = P_meas : Last_value_high = P_meas
Case 6
Ist_wert = R_meas : Last_value_high = R_meas
End Select
[/code:1:bcb7455dd6]
So am I right to assume, that multiple statements after a CASE only work, when I write them in a new line?
(Like the "IF-THEN-ELSE-ENDIF" short and long version)
Kind regards
Roger
[b:bcb7455dd6][color=red:bcb7455dd6](BASCOM-AVR version : 2.0.7.6 )[/b:bcb7455dd6][/color:bcb7455dd6]
↧