Parsing an MDMF CID String ?
skynugget
Posts: 172
Hey all, i have a bs2 hooked up to an old caller id chip and im having trouble picking out all of the serial data.
the MDMF format is as follows
Each byte is in HEX.
# 80 - Message type word, 80 indicates MDMF
# 20 - Length of data, 32 bytes in date,time,name and number
# 01 - data type, 1 = date & time
# 08 - length of date and time, 8 bytes
# 30,33 - 03, March
# 32,34 - 24, 24th day
# 30,39 - 09, hour
# 30,32 - 02, minutes (9:02am)
# 07 - data type, 7 = name
# 08 - length of name, 8 bytes
# 4A - 'J'
# 4F - 'O'
# 48 - 'H'
# 4E - 'N'
# 20 - ' ' (space)
# 44 - 'D'
# 4F - 'O'
# 45 - 'E'
# 02 - data type, 2 = phone number
# 0A - length of phone number, 10 bytes
# 38 - 8
# 30 - 0
# 30 - 0
# 35 - 5
# 35 - 5
# 35 - 5
# 31 - 1
# 32 - 2
# 31 - 1
# 32 - 2
# 7D - Checksum
I'm trying to use this code to grab the first 9 bytes of the name, then the phone number at 2400bps.
my guess is this routine is to slow to wait for the second header, if i take out the timeout it just hangs forever. is this possible for the bs2 to do this?
thanks so much!
Post Edited (skynugget) : 3/22/2009 6:24:42 PM GMT
the MDMF format is as follows
Each byte is in HEX.
# 80 - Message type word, 80 indicates MDMF
# 20 - Length of data, 32 bytes in date,time,name and number
# 01 - data type, 1 = date & time
# 08 - length of date and time, 8 bytes
# 30,33 - 03, March
# 32,34 - 24, 24th day
# 30,39 - 09, hour
# 30,32 - 02, minutes (9:02am)
# 07 - data type, 7 = name
# 08 - length of name, 8 bytes
# 4A - 'J'
# 4F - 'O'
# 48 - 'H'
# 4E - 'N'
# 20 - ' ' (space)
# 44 - 'D'
# 4F - 'O'
# 45 - 'E'
# 02 - data type, 2 = phone number
# 0A - length of phone number, 10 bytes
# 38 - 8
# 30 - 0
# 30 - 0
# 35 - 5
# 35 - 5
# 35 - 5
# 31 - 1
# 32 - 2
# 31 - 1
# 32 - 2
# 7D - Checksum
I'm trying to use this code to grab the first 9 bytes of the name, then the phone number at 2400bps.
SERIN DataIn,CIDBaud,1000, NoNumber,[noparse][[/noparse]WAIT($07), SKIP 1,STR NameData\10] 'wait for hex 7 name header SERIN DataIn, CIDBaud,1000, NoNumber,[noparse][[/noparse]WAIT($02), SKIP 1, STR CIDData\10] ' wait for hex 2 phone header DEBUG STR NameData,CR DEBUG STR CIDData,CR
my guess is this routine is to slow to wait for the second header, if i take out the timeout it just hangs forever. is this possible for the bs2 to do this?
thanks so much!
Post Edited (skynugget) : 3/22/2009 6:24:42 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
-Phil
phill, you are correct it will get garbled, but my name is longer then that, and i figured i'd cross that bridge once i can crab all the data :>
-Phil
One thing I would consider though is that instead of trying to "skip" the two bytes that contain the string lengths of the name and number is to read them and use them to your advantage.
Here is a piece of code you can use with the BS2 that will read a name as large as 14 characters and a number as large as 10 , any larger strings will get truncated . All variable space is used by the three arrays so if you need additional variables you will have to offload the arrays and re-use some of the array space . The array len is used to read the string lengths to allow for variation in size.
You can use a similar code with scratchpad ram .
Jeff T.
the MDMF format is as follows
Each byte is in HEX.
# 80 - Message type word, 80 indicates MDMF
# 20 - Length of data, 32 bytes in date,time,name and number
# 01 - data type, 1 = date & time
# 08 - length of date and time, 8 bytes
# 30,33 - 03, March
# 32,34 - 24, 24th day
# 30,39 - 09, hour
# 30,32 - 02, minutes (9:02am)
# 02 - data type, 2 = phone number
# 0A - length of phone number, 10 bytes
# 38 - 8
# 30 - 0
# 30 - 0
# 35 - 5
# 35 - 5
# 35 - 5
# 31 - 1
# 32 - 2
# 31 - 1
# 32 - 2
# 07 - data type, 7 = name
# 08 - length of name, 8 bytes
# 4A - 'J'
# 4F - 'O'
# 48 - 'H'
# 4E - 'N'
# 20 - ' ' (space)
# 44 - 'D'
# 4F - 'O'
# 45 - 'E'
# 7D - Checksum
the number comes first. the bs2 is fast enough to parse it though. it works great!! i figured it out by finally unsealing my bs2px and reading out the raw hex from my caller id chip... duh
thanks!
Post Edited (skynugget) : 3/26/2009 5:45:49 PM GMT
Jeff T.