axe033 bcdtoascii

coin12

New Member
i want to display the time from rtc to lcd using 18x but nothing is displayed
with this code

i2cslave %11010000,i2cslow,i2cbyte
writei2c 0,($00,$57,$11,$03,$25,$12,$03,$10)
pause 10
main:
i2cslave %11010000,i2cslow,i2cbyte
readi2c 0,(b0,b1,b2)
bcdtoascii b0,b3,b4
bcdtoascii b1,b4,b5
bcdtoascii b2,b6,b7
writei2c 0,(254,128,255)
pause 10
writei2c 0,(b3,b4,":",255)
pause 10
writei2c 0,(b4,b5,":",255)
pause 10
writei2c 0,(b6,b7,":",255)
pause 30
goto main
i think the problem is on my code i dunno how to display the time by using bcdtoascii command

plz help
 

BCJKiwi

Senior Member
Couple of things come to mind;
1. Do you intend to re-use b4?
bcdtoascii b0,b3,b4
bcdtoascii b1,b4,b5
bcdtoascii b2,b6,b7

2. Don't see where the data is being sent to the LCD

It appears that the data intended for the LCD is being sent to the RTC.
writei2c 0,(254,128,255)
pause 10
writei2c 0,(b3,b4,":",255)
pause 10
writei2c 0,(b4,b5,":",255)
pause 10
writei2c 0,(b6,b7,":",255)

The writei2c 0 is sending the ASCII data back to the clock which will not get to the LCD, AND, will confuse the clock.
 

coin12

New Member
but writei2c 0,("hello123",255) is working
anyway wut should be the right command for displaying
is serout ,n2400 will work in i2c mode im connecting only two wires scl/sda
or sertxd
 

westaust55

Moderator
Your code is virtually identical to that presented by member PaulHetrel recently at
http://www.picaxeforum.co.uk/showthread.php?t=9692&highlight=AXE033.
Unfortunately Paul started using PM's to me for completion of his code so others missed the end results. Here are the fixes I gave him at that time.

EDIT: good reason for not using PM's as others miss information / solutions

Code:
Main:
INITIALISE AND READ FROM DS1307
i2cslave %11010000, i2cslow, i2cbyte' initialise DS1307
readi2c 0,(seconds,mins,hour,day,date,month,year,control)' write time and date to DS1307 registers

'INITIALISE AXE033 (DISPLAY)  ; [B][COLOR="Red"]this was missing[/COLOR][/B]
i2cslave %11000110, i2cslow, i2cbyte 'initialise for writing to AXE033 (Display) 

'CONVERSIONS TO ASCII and display [B][COLOR="Red"]; which overcomes wrriting over data before it is used![/COLOR][/B]
SYMBOL tens = b8 ; can move these declarations to the top of the program
SYMBOL units = b9

BCDTOASCII hour, tens, units
writei2c 0, (tens,units,”:”,255)
pause 10

BCDTOASCII mins, tens, units
writei2c 0, (tens,units,”:”,255)
pause 10

BCDTOASCII seconds, tens, units
writei2c 0, (tens,units,255)
pause 10

goto main
 
Last edited:

BCJKiwi

Senior Member
OK, I don't have an AXE 033 and assumed it was serial but now see that it is optional i2c as well.

When you indicate;
writei2c 0,("hello123",255) is working, this is not in your program above.

With i2c the device has to be specified, and the register to read from/write to as appropriate.

When there is only one i2c device, then you only need one i2cslave command. When you have more than one i2c device, you need to issue a new i2cslave command with the i2c device address every time you change devices so the following read/write commands are pointed to the correct i2c device.

That does not seem to be happening as both i2cslave commands point to the RTC.

Take another look at Manual2 page69 and 70;
DS1307 RTC %11010000 i2cslow i2cbyte
AXE033 I2C LCD $C6 i2cslow i2cbyte
 
Top