Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Experiencing the code .
Goto page Previous  1, 2
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 971

poland.gif
PostPosted: Mon Aug 31, 2015 8:04 am    Post subject: Reply with quote

Quote:
LED flashing 100 ms ON / OFF SWITCH Pressing AND WHEN NOT CLICK LED blinks every 300ms ON/OFF in this example-2 is that I want.


Code:
$regfile = "m16def.dat"
$crystal = 1000000
$hwstack = 40
$swstack = 16
$framesize = 32

Config Pind.7 = Output : Led Alias Portd.7
Config Pinb.0 = Input : Switch Alias Pinb.0 : Portb.0 = 1  

Do

 Toggle Led
  If Switch = 0 Then Waitms 100 Else Waitms 300

Loop
End
Back to top
View user's profile Visit poster's website
Printpix52

Bascom Member



Joined: 18 Jun 2014
Posts: 282
Location: D.F.

mexico.gif
PostPosted: Mon Aug 31, 2015 10:12 am    Post subject: Reply with quote

EDC wrote:
Quote:
LED flashing 100 ms ON / OFF SWITCH Pressing AND WHEN NOT CLICK LED blinks every 300ms ON/OFF in this example-2 is that I want.


Code:
$regfile = "m16def.dat"
$crystal = 1000000
$hwstack = 40
$swstack = 16
$framesize = 32

Config Pind.7 = Output : Led Alias Portd.7
Config Pinb.0 = Input : Switch Alias Pinb.0 : Portb.0 = 1  

Do

 Toggle Led
  If Switch = 0 Then Waitms 100 Else Waitms 300

Loop
End



Very Happy Very Happy Very Happy

Do
'Cuando es presionado el boton
Toggle Led
If Switch = 0 And Led = 0 Then
Set Led
Waitms 100
Reset Led
Waitms 100
'Cuando no es presionado el boton
Elseif Switch = 1 And Led = 1 Then
Reset Led
Waitms 300
Set Led
Waitms 300
End If
Loop
End


Last edited by Printpix52 on Mon Aug 31, 2015 10:42 am; edited 2 times in total
Back to top
View user's profile
Printpix52

Bascom Member



Joined: 18 Jun 2014
Posts: 282
Location: D.F.

mexico.gif
PostPosted: Mon Aug 31, 2015 10:38 am    Post subject: Re: Small check on my side... Reply with quote

bzijlstra wrote:


To be honest, I had my doubts about the LED being read. But I have tested that part and it gives a 1 and a 0 while the LED is on or off.

Have fun
Ben Zijlstra


Config Pinb.7= Output
Led Alias Portb.7

Very Happy
Back to top
View user's profile
Printpix52

Bascom Member



Joined: 18 Jun 2014
Posts: 282
Location: D.F.

mexico.gif
PostPosted: Mon Aug 31, 2015 10:42 am    Post subject: Reply with quote

[quote="Printpix52"]
EDC wrote:
Quote:
LED flashing 100 ms ON / OFF SWITCH Pressing AND WHEN NOT CLICK LED blinks every 300ms ON/OFF in this example-2 is that I want.


[code]$regfile = "m16def.dat"
$crystal = 1000000
$hwstack = 40
$swstack = 16
$framesize = 32

Config Pind.7 = Output : Led Alias Portd.7
Config Pinb.0 = Input : Switch Alias Pinb.0 : Portb.0 = 1

Do

Toggle Led
If Switch = 0 Then Waitms 100 Else Waitms 300

Loop
End



Very Happy Very Happy Very Happy

Do
'Cuando es presionado el boton
Toggle Led
If Switch = 0 And Led = 0 Then
Set Led
Waitms 100
Reset Led
Waitms 100
'Cuando no es presionado el boton
Elseif Switch = 1 And Led = 1 Then
Reset Led
Waitms 300
Set Led
Waitms 300
End If
Loop
End
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Aug 31, 2015 3:32 pm    Post subject: Is it working? Reply with quote

Is there a question in your last item?

I see just a quote of a quote.

Is it working now?

Ben Zijlstra
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
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