Hello,
I tried to use "Alias" command for an input pin. But could not get it work. By using DDRx, PORTx, PINx it worked as bellow:
[code:1:3db0355303]
$regfile = "m8def.dat"
$crystal = 16000000
$hwstack = 40
$swstack = 16
$framesize = 32
'$sim
Config Lcd = 16x2
Config Lcdpin = Pin , Db4 = Portd.5 , Db5 = Portd.6 , Db6 = Portd.7 , Db7 = Portb.0 , E = Portd.3 , Rs = Portd.2
Cls
Lcd "Start."
Wait 1
Cls
Ddrc.0 = 0 'Pin as input
Portc.0 = 0 'pin pullup off. Resistor pulldown used.
Main:
While Pinc.0 = 0 'Do nothing while pin is low. Don't use bitwait.
nop
Wend
Lcd "Pin High"
Wait 1
Cls
Goto Main
[/code:1:3db0355303]
And used "Alias" command for the above code as:
[code:1:3db0355303]
$regfile = "m8def.dat"
$crystal = 16000000
$hwstack = 40
$swstack = 16
$framesize = 32
'$sim
Config Lcd = 16x2
Config Lcdpin = Pin , Db4 = Portd.5 , Db5 = Portd.6 , Db6 = Portd.7 , Db7 = Portb.0 , E = Portd.3 , Rs = Portd.2
Cls
Lcd "Start."
Wait 1
Cls
Rpin Alias Portc.0 'Make alias as Rpin
Config Rpin = Input 'Make Rpin as Input
Rpin = 0 'Pullup Off
Main:
While Rpin = 0 'Do nothing while pin is low. Don't use bitwait.
nop
Wend
Lcd "Pin High"
Wait 1
Cls
Goto Main
[/code:1:3db0355303]
Is there any mistake in the code?
Thanks.
[b:3db0355303][color=red:3db0355303](BASCOM-AVR version : 2.0.7.6 )[/b:3db0355303][/color:3db0355303]
↧