Help convert 24 hour format on axe033 lcd to 12 hour format clock

westaust55

Moderator
Are you trying to use the AXE033 with Clock option in the more typical serial mode with SEROUT command (in which case it cannot be achieved as time & date display is inbuilt as if a message to bottom line) or the i2c mode (where the AXE033 has less capabilities but can read time into PICAXE to manipulate)
 

hippy

Ex-Staff (retired)
Assuming the 24 and 12 hour times are in decimal ...

t12 = t24 Mod 12
If t12 = 0 Then : t12 = 12 : End If
 

hippy

Ex-Staff (retired)
Sorry "MOD" is represented by % or // in PICAXE Basic -

t12 = t24 // 12
if t12 = 0 then : t12 = 12 : end if
 
Is that the actual code. Forgive me. It could just be a syntax example. There variable for time is (0). I'd like to see it expanded
 

Rick100

Senior Member
Is that the actual code. Forgive me. It could just be a syntax example. There variable for time is (0). I'd like to see it expanded
Hello,
Could you describe what hardware your trying to use . For example, an axe033 driven in serial mode by an 18m2. Please post the program your referring to wher "variable for time is (0)". If you are trying to use the axe033 in serial mode, you can't retrieve the time as westaust55 said in post2, so you can't convert it. You would have to run the display and clock in i2c mode, which is more involved.

In the program hippy posted, t24 and t12 are byte variables. Here is his code in a program. Run it in the simulator to see how it works.

Code:
#picaxe 18m2
#terminal 4800

symbol t12 = b3 
symbol t24 = b4

t24 = 23	' 11PM / change this number for different 24 hour times to convert

t12 = t24 // 12
if t12 = 0 then : t12 = 12 : end if 

sertxd("Original t24 hour variable = ")
sertxd(#t24,13,10)
sertxd("Converted t12 hour variable = ")
sertxd(#t12,13,10)

end

Good luck,
Rick
 

westaust55

Moderator
In serial mode. You answered question
If you are operating the AXE033 in serial mode, then irrespective of the PICAXE chip used, you cannot alter the format that the time and date are presented.

Using SEROUT <pin>, baudrate, (253, . . . .
with the parameter 0 (zero) initiates a routine within the AXE033 to display the time and date on the bottom line in a pre-defined format.
there is no way to change this presentation using the serial comms mode.
 
Top