Home AMX User Forum NetLinx Studio

store into mem

hello

how can i store a variable with a text like '00:00:00'

i have now make this. (but it is not working)

persistent char timestore[100]


volatile char storestarttime[8]
volatile char storestoptime[8]
CHAR TimeStr[ ] = '8:00:00'
integer stoptijd
sinteger uur
sinteger minute
char str
char systemtime[ ] = '08:00:00'
char systemdate[ ] = '01-01-2008'
char starttime[8]
char stoptime[8]



DEFINE_CALL 'savetime'(nummer)
{
timestore[((8 * nummer) - 1)]= storestarttime[8]
timestore[((8 * nummer) - 2)]= storestoptime[8]

}
DEFINE_CALL 'recaltime'(nummer)
{
storestarttime = timestore[((12 * nummer) - 1)]
storestoptime = timestore[((12 * nummer) - 2)]
}

DEFINE_START
SEND_COMMAND dvMGP,"'SET BAUD 9600,N,8,1 485 DISABLE'"
SEND_COMMAND dvscreen,"'SET BAUD 9600,N,8,1 485 DISABLE'"

call 'recaltime'(1)
call 'recaltime'(2)

send_string dvScreen,"storestarttime,' > ', storestoptime"

button_event[dvpanel,71] //Page Preset Hour "+"
{hold[1, repeat]:
{ minute = minute + 1
if (minute>59)
{minute=0
uur = uur +1}
if(uur>24)
{uur=24}
SEND_COMMAND dvpanel,"'^TXT-72,1&2,',(FORMAT('%02d',uur)),':',(FORMAT('%02d',minute))"

{starttime = "FORMAT('%02d',uur),':',FORMAT('%02d',minute),':','00'"
storestarttime = starttime
call 'savetime'(1)}

Comments

  • ericmedleyericmedley Posts: 4,177
    You need to convert the numbers to ascii in the cases where you're trying to make calculations and then store them in your char arrays.

    the number '1' does not equal charactor '1'.

    Use the ITOA() keyword to convert a number value to a char value.
Sign In or Register to comment.