Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Select case from too..ATinny13

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 692

poland.gif
PostPosted: Fri Jun 13, 2014 7:04 pm    Post subject: Select case from too..ATinny13 Reply with quote

My curiosity tells me to ask why this code does not work for ATtinny13.
I also tried to write a single line. Colon and without..

Code:
$regfile = "attiny13.dat"
$crystal = 1200000
$hwstack = 24
$swstack = 18
$framesize = 16

Dim Adc_value As Word
Config Adc = Single , Prescaler = Auto , Reference = Avcc

Config Portb.0 = Output
Led Alias Portb.0
'-----------------------------------------------------------------------------
Do

  Waitms 10

  Adc_value = Getadc(3)

  Select Case Adc_value

   Case 1024 To 500

   Reset Led

   Case 500 To 0

   Set Led

  End Select
Loop

End


This is only a sample. I needed moore steps between 1024 -0
If I wrote "If Adc_value <500 and Adc_value >0 then" ..everything work.
Finally I finish this small programm another way but want to know what I do wrong.

(BASCOM-AVR version : 2.0.7.7 )
Back to top
View user's profile Visit poster's website
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 375
Location: Wuppertal, Germany

germany.gif
PostPosted: Fri Jun 13, 2014 7:23 pm    Post subject: Reply with quote

Just an idea, it's not tested:
Try "case 0 to 500".
500 to 0 could be interpreted as
(Bigger than 500 AND smaller than 0), which will never be true.
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 692

poland.gif
PostPosted: Fri Jun 13, 2014 7:34 pm    Post subject: Reply with quote

Laughing I`m blinded... Even in help wrote from -5 to -2 so.. value can only grow Thanks
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum