[AVR] am having problems with using oshonsoft to write/read codes into EEPROM of AVR MCU

Status
Not open for further replies.

TOCHI

Newbie level 5
Joined
Oct 11, 2013
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
85
I am finding it very difficult to write basic programs in oshonsoft compiler for reading/writing four different numbers into the EEPROM of AVR (Atmega 16L) microcontrollers....
pls, i need urgent help. thank you.

The codes are added below ( basic program for oshonsoft compiler)...
Define SIMULATION_WAITMS_VALUE = 1
DDRA = 0 'setting porta as input

Define LCD_LINES = 2
Define LCD_CHARS = 16
Define LCD_BITS = 8
Define LCD_DREG = PORTB
Define LCD_DBIT = 0
Define LCD_RSREG = PORTD
Define LCD_RSBIT = 1
Define LCD_EREG = PORTD
Define LCD_EBIT = 3
Define LCD_RWREG = PORTD
Define LCD_RWBIT = 2
Lcdinit 1


Dim a As Byte
Dim b As Byte
Dim c As Byte
Dim d As Byte
Dim e As Byte
Dim f As Byte
Dim g As Byte
Dim h As Byte
Dim i As Byte
Dim j As Byte
Dim k As Byte
Dim l As Byte
Dim m As Byte


a = 0
b = 0
c = 0
d = 0
e = 0
f = 0
g = 0
h = 0
i = 0
j = 0
k = 0
l = 0
m = 0





Lcdout "coded lock"

Lcdcmdout LcdLine2Home

Lcdout "waiting..."
WaitMs 1000
WaitMs 1000


starter:

If PINA.1 = 1 Then Gosub inc
If PINA.2 = 1 Then Gosub dec
If PINA.3 = 1 Then Gosub enta
If PINA.4 = 1 Then Gosub show

Goto starter
End

inc:
Lcdcmdout LcdLine2Clear
Lcdcmdout LcdLine2Home

If a < 10 Then
a = a + 1
'b = b + 1

Lcdout "number=", #a
Else
a = 0
Endif
Return

dec:
Lcdcmdout LcdLine2Clear
Lcdcmdout LcdLine2Home

If a > 1 Then
a = a - 1
'b = b - 1

Lcdout "number=", #a
Else
a = 10
Endif
Return

enta:
Lcdcmdout LcdLine2Clear
Lcdcmdout LcdLine2Home

e = e + 1

If e = 1 Then

Write c, a

Read c, d

Lcdout "stored ", #d

Else

If e = 2 Then
Write f, a

Read f, b

Lcdout "stored ", #b

Else
If e = 3 Then


Write g, a

Read g, l

Lcdout "stored", #l

Else
If e = 4 Then

Write h, a


Read h, m

Lcdout "stored", #m

Endif
Endif
Endif
Endif

Return

show:
Lcdcmdout LcdLine2Clear
Lcdcmdout LcdLine2Home
'Lcdout "processing"

'read:
Read c, d
Read f, b
Read g, l
Read h, m






Lcdcmdout LcdLine2Home
Lcdout "code = ", #d, #b, #l, #m

WaitMs 1000
WaitMs 1000
WaitMs 1000

'Lcdcmdout LcdLine2Home
'Lcdout "code 2= ", #b


'Lcdcmdout LcdLine2Home


'Lcdout "code 3= ", #l

'Lcdcmdout LcdLine2Home
'Lcdout "code 4= ", #m






Return
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…