Attiny2313 code modding

Status
Not open for further replies.

yurac

New Member
How can I make an ATtiny2313 code copatibel to ATmega8.

Code:


$regfile = "2313def.dat"
$crystal = 4000000
'$noramclear

Config Portb = Output
Config Portd = Input
Portb = &B00000000
Portd = &B00000000

Motor_lp Alias Portb.0
Motor_lt Alias Portb.1
Motor_pp Alias Portb.3
Motor_pt Alias Portb.2

Sensor_p Alias Pind.2
Sensor_s Alias Pind.5
Sensor_l Alias Pind.4


Do
If Sensor_l = 1 And Sensor_s = 0 And Sensor_p = 1 Then 'go along
Gosub Go

Elseif Sensor_l = 0 And Sensor_s = 1 And Sensor_p = 1 Then 'turn left
Gosub Lewt

Elseif Sensor_l = 0 And Sensor_s = 0 And Sensor_p = 1 Then 'turn left
Gosub Lewt


Elseif Sensor_l = 1 And Sensor_s = 1 And Sensor_p = 0 Then 'turn right
Gosub Righ

Elseif Sensor_l = 1 And Sensor_s = 0 And Sensor_p = 0 Then 'turn right
Gosub Righ



End If
Loop


Go:
Motor_lt = 1
Motor_pt = 1
Return
Lewt:
Motor_lt = 0
Motor_pt = 1

Return
Righ:
Motor_lt = 1
Motor_pt = 0

Return
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…