RickTaylor Posted October 31, 2004 Report Posted October 31, 2004 Hi Peter, I've been trying to read offset 311E today through a PH defined in EPICIO.cfg. This reads the Standby Nav1 freq. from FS9. I get the wrong format of data passed through into B0 and B1 though. It's reading 054 and 072 for example when I should be getting 015 and 060. Having looked at the EPIC log, I've found that the correct HI & LO frequencies are there but they are in Hex 0x15 and 0x60. This seems to conflict with PH2 that reads the bits directly. Any comments ? How can I use the PH to read the Hex values thus getting the correct frequencies ? or do I have to convert them in EPL and if so, how is this done ? Hope you can shine some light on this for us. Cheers
Pete Dowson Posted October 31, 2004 Report Posted October 31, 2004 Having looked at the EPIC log, I've found that the correct HI & LO frequencies are there but they are in Hex 0x15 and 0x60. This seems to conflict with PH2 that reads the bits directly. Not sure I understand. "Reads bits directly" would imply that you get what FS gives me -- and that is hex BCD, i.e. 0x1560 for 115.60. Do the older PHs convert those to decimal? If the two are different this is probably a bug. I'm afraid I cannot test changes to any of my EPIC stuff these days as I don't use EPIC at all. I am therefore rather reliant on feedback, and no one has mentioned this before. If you can clarify for me (show me a log line for NAV1 use and NAV1 standby so I can see what is hapening), I'll try to fix it and send you an update to test. Please send details to me at petedowson@btconnect.com so I can reply with and attachment. It may be a day or two. Regards, Pete
Pete Dowson Posted November 1, 2004 Report Posted November 1, 2004 Here's the EPICINFO.log file. Look down at the bottom for the offending items. I am reading PH2 - NAV1 active and a defined PH200 - NAV1 Standby at offset 311E. The frequency is there in the latter, but only in Hex. This differs from the PH2 readout. Oh, NOW I see! I thought you were referring to two facilities provided by EPICINFO which should give the same format but don't. No, everything is perfectly correct. When you read any offset using the generic offset reading facility, EPICINFO has no idea whatsoever what it contains and therefore cannot convert it for you. If you want them both in the same format, read the NAV1 "use" frequency from offset 0x0350 the same way. If you need them in decimal you will have to convert them in EPL. I don't remember what maths facilities are in EPL now but you need something to do this, for each byte: (10 * ( x / 16)) + (x % 16) where * is multiplication, / is division (losing remainder) and % is getting the remainder. Or (10 * (x >> 4)) + (x & 15) where >> is 'shift right by' and & is 'logical AND'. Alternatively, if you can send one digit at a time to the display, then just use shifts and 'ands'. i.e (x >> 4) for the first digit in a byte and (x & 15) for the second digit. I think that Ralph was trying to make the new EPL quite C-like, so maybe my nomenclature here is the same in EPL. Sorry, I am very out of touch with all things EPIC these days! Regards, Pete
RickTaylor Posted November 1, 2004 Author Report Posted November 1, 2004 Yesss !!! That's it Pete. Thanks a lot for the help. It didn't work at first as I was only reading 2 bytes, (The wrong two.) I had a look again and saw there were FOUR bytes, so I read the lot and converted B2 and B3. That gives the Standby frequency. QED ! There's some clever folk from Stoke. I went to North Staffs Poly ages ago. Cheers Rick
Pete Dowson Posted November 1, 2004 Report Posted November 1, 2004 That's it Pete. Thanks a lot for the help. Good, glad you got it sorted. There's some clever folk from Stoke. I went to North Staffs Poly ages ago. Small world 9but i wouldn't want to paint it! :wink: I've lived around here for 40 years (since I got married in fact), but I'm actually from Middlesex, near London, and went to Bristol University. Incidentally, North Staffs Poly is now part of Staffordshire University! :) Regards, Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now