PDA

View Full Version : Why does this PBP statement post the wrong time values?



jellis00
- 13th November 2011, 06:51
I am using a ConnectOne MiniSocket WiFi module to post a time value to a website, as determined by my embedded microcontroller application. To do this I use the following PBP statement in my code to send a command over a serial interface to the ConnectOne WiFi module to FTP the time value in the variables HH and MM in the HH:MM format to the web site.
The "AT+iFSND:000,5:" parameter in this SEROUT2 statement is a command to the WiFi module to FTP the time value data to the website where it is written to a text file that is read by the server-side PHP code and displayed in the client's browser. I thought that since the time values are BCD format in the microcontroller and normally sent when using PBP to an LCD as HEX2 values in order for them to be displayed properly, that I should use the same convention for FTPing the data to the website. Yet when the time is 00:24 clock time in the embedded microcontroller, what shows up on the website when using this statement is 34:34 as displayed by the web browser.

SEROUT2 TX,84,["AT+iFSND:000,5:",HEX2 hr,":",HEX2 MINs,$d,$a]

Can anyone tell me why this statement is producing these incorrect results at the website? I have unsuccessfully trying to figure this problem out for many days and it is driving me crazy. I tried using DEC2 also and it still produces incorrect results. I know the time is correct in the microcontroller because I am also writing HH and MM values to EEPROM so I can read them ater each run to see what the values are and they are correct in the microcontroller but show up incorrectly on the website.

rsocor01
- 13th November 2011, 09:10
Jellis00,

Not much help here :apologetic:, just a suggestion. Why don't you try sending different sequencial values like 00:00, 00:01, 00:02, ...... etc., record the time values at the website and try to see if you find any pattern. This might give you a clue as to what the problem is.

Robert

mackrackit
- 13th November 2011, 09:11
I will guess that you will need to convert to ASC||. Probably a better way but here is what I use.

READ_RTC:
I2CREAD DS_SDA, DS_SCL, RTC, SEC_REG, [sec,mins,hr,day,date,mon,yr]

SEC_T = sec & $70
SEC_T = SEC_T>>4
SEC_O = sec & $0F

MIN_T = mins & $70
MIN_T = MIN_T>>4
MIN_O = MINs & $0F

HR_T = hr & $70
HR_T = HR_T>>4
HR_O = hr & $0F

MON_T = mon & $70
MON_T = MON_T>>4
MON_O = mon & $0F

DATE_T = date & $70
DATE_T = DATE_T>>4
DATE_O = date & $0F

YR_T = yr & $70
YR_T = YR_T>>4
YR_O = yr & $0F


CRON[0] = " "
CRON[1] = $30+HR_T
CRON[2] = $30+HR_O
CRON[3] = ":"
CRON[4] = $30+MIN_T
CRON[5] = $30+MIN_O
CRON[6] = ":"
CRON[7] = $30+SEC_T
CRON[8] = $30+SEC_O
CRON[9] = $d
CRON[10] = $a


CRON_D[0] = " "
CRON_D[1] = $30+MON_T
CRON_D[2] = $30+MON_O
CRON_D[3] = "/"
CRON_D[4] = $30+DATE_T
CRON_D[5] = $30+DATE_O
CRON_D[6] = "/"
CRON_D[7] = $30+YR_T
CRON_D[8] = $30+YR_O
CRON_D[9] = $d
CRON_D[10] = $a
RETURN

jellis00
- 22nd November 2011, 03:10
Jellis00,

Not much help here :apologetic:, just a suggestion. Why don't you try sending different sequencial values like 00:00, 00:01, 00:02, ...... etc., record the time values at the website and try to see if you find any pattern. This might give you a clue as to what the problem is.

Robert

A good suggestion which I tried. Still couldn't see what was happening. Yet, for some reason when I went back to using this statement it worked and I don't know why or what changed. At anyrate it is now working and this command to my ConnectOne iWiFi MiniSocket module posts the PIC read time from the DS1337 to my website.

SEROUT2 TX,84,["AT+iFSND:000,5:",HEX2 hr,":",HEX2 MINs,$d,$a]:PAUSE 100