When I was young I was doing this manually .
Just convert the hex number to a binary and do bit check with negating it.
I am sure there is a bit operation available which can do it for you, depending which script language you need.
Hi,
how does one negate hex values?
i have a problem that where, for example, the hex value CF is negated to 30 and i have never done anything like this before so am totally lost.
I actually have a lot of HEX nibbles that need to be negated one at at time
and I wish to produce either a script or program that will do this automatically.
Any help, suggestions or advice greatly appreciated.
Thanks
porkop
Look Here -> |
When I was young I was doing this manually .
Just convert the hex number to a binary and do bit check with negating it.
I am sure there is a bit operation available which can do it for you, depending which script language you need.
To behonest, I am in unfimilar ground. My limited programming experience was with qbasic way back when, and a tiny bit of C.
Basically I want to read out the hex values from of an eprom image and manipulate those values to a more human form. building up a mathematical forumla is not issue for me but understanding how to do this negating is.
easy, have been playing with this today with the windows calculator.hex number to a binary
Now I fall overand do bit check with negating it
porkop
It's very easy Porkop.
You know how a NOT gate works.
0 -> 1
1 -> 0
Negating HEX is just the same. As mentioned, the simplest way is just to convert it to a binary number, invert all the bits and convert that back to a hex number.
I've been programing assembler for a very long time and so I can convert hex to binary to hex subconsciously.
Anybody can do it, but doing it quickly takes a little practise to make it look like your a savant.
Work with single digit hex numbers 0 to F (four digit binary).
When you see the number the other digits appear in your head.
1 = 0001
2 = 0010
4 = 0100
8 = 1000
A = 1010
C = 1100
0 = 0000
F = 1111
So if you see a number 0x3A7D.
break it down into it's digits
3 A 7 D
0011 1010 0111 1101
to negate it use the "NOT" on each bit.
1100 0101 1000 0010
C 5 8 2
!0x3A7D = 0xC582
(! is used to describe the NOT function)
(0x is used to describe a hex number.)
you can convert to decimal or octal as required
thanks trash. that is very well explained.
I dont think I will be doing it in my head any time soon but at least I know
the process and can work on my project.
regards
porkop
What's your project ?
ah ok, I'm not much up on the FM900. You could just build yourself an XOR buffer. When you enable the buffer it negates the byte, when you disable it, normal data passes.
In a pic chip it would just be....
Code:xorlw 0FFh (negate) xorlw 000h (buffer)
Yea I thought about a pic based decoder, but that is even a deeper hole for me . Anyway, I will take onboard all that has been said, suggested etc and have a damn good think.
Thanks to all.
porkop
Well if you want me to program a pic up for ya pork, it's no probs. Just describe what you want it to do and I can mail you the chip, or just email you the hex file and you can have elvis load it on your own chip.
you got that much time trash......could take a few years lol
Not really, some things are simpler than they seem.
Many hands make light work. If you can describe what needs to be done, then I can write the code.
I just did one for paragliding comps where they want to log engine use for paramotors and log the activity to the GPS's memory. It took a couple of weeks to write from scratch but it wasn't hard. Just pluck away at it step by step.
If you can put it into a flow chart, I can probably write the code quite quickly.
I am not sure what you know of the FM900 series of transceivers....but they are a VHF or UHF 99 channel eprom programmable FM transceiver, at least the FM92 model. To program the eprom you use the FPP.EXE (Field Personality Programmer) software. You set the various HARDWARE and SOFTWARE codes, ie, Band, Channel Spacing, Signalling Hardware, Remote or Local control head, CTCSS info, Time out Timer, power level...blah blah..and so on. Anyway, the FPP.EXE software is meant to pe coupled to a propirety eprom programmer, however, the software produces a BIN file that is suitable for general programming by nearly any eprom programmer. So no real problem there. However, also along with the FPP.EXE files are CHL (channel) and JOB files. these hold the information that enables editing and adding/subtracting of the BIN image for any upgrades/mods that the user may want. All good and well in the hay days of the FM900 but these days with them all on the 2nd hand marked if you happen to get one and want to see what is on the eprom well it is a bit hard if you dont have the original propirety eprom programmer. So, nice peoples over the years have debugged the eprom to point to the various locations in said image that mean this and that, eg, channels start at memory location $1EB0, consist of 3 nibbles for RX, 3 nibbles for TX and what I think are 2 nibbles containing $00 ea as a buffer?
Other debugged memory locations reveal things like, start up channel, master image file used in the original build etc etc and of course the prerequesit checksum. Generally enough information to play with FPP to at least set the basic Hardware and Software codes to start customizing an eprom image. Or like someone recently did was to hack the eprom image to make a repeater reverse option available. And this is where I entered. I liked the idea of the repeater reverse option for my FM92 but the supplied image did not have my favorite simplex channels nor the setup I generally do for myself when programming a FM900 series radio.
So it really snow balled from that that I thought a little utility to take the eprom image read from a eprom and run over it to create an output file that contained as much "human readable" information as could be extracted would be advantagous.
But as stated, my programming skills are limited, my understanding is also limited but my desire and enthusaium is almost limitless .A pic based reader is appealing but would be somewhat limited as to hardcopy output of the whole image. As a step by set reader, well, who knows.
Anyway Trash, I hope to have shed some light on the idea I have, you may have already known about this, maybe not.
regards
porkop
Ah ok, I can see what your doing. You really need a EEPROM programer (you might already have one). They're getting a little hard to find these days.
I take it you don't have the original FM900 software ?
The radio just needs a good old hack, using the old method.
Do you know if you can actually remove the EEPROM from the radio and swap them ?
Ideally, program up one eeprom and then a second, read off the eeproms into a hex file and compare them. Once difference at a time.
That's the easy way. The hard way is to get two radios that have the same channels and start changing bytes one at a time and running them in the radio to see what the change does.
Another method is to get two radios that are already different and comparing the differences in the eeproms, then changing the bytes and predicting the changes.
It's not all that hard, it's just slow because there is a physical process of inserting and removing the eeproms.
The old software may do one of two things.
Byte read and write, which is gives an address to read or write from.
Or, it might do a block read and write, reading and writing the whole eeprom every time.
If you have the software, you can monitor the serial line to see what instructions are sent and what the responses are.
There is a very good example of a hack I did over 10 years ago now.
To cut a long story short, the hack is almost identical the difference is that it's a gaming software compared to a hardware radio.
Instead of eeproms, the game uses .map files.
If you have a copy of a complete eeprom as a file, and can tell me the configuration, I can probably reverse engineer the code.
A quick google search and it appears that plenty of people may have already done the hard work.
I found this one
some quick info on the eeproms.
27C64-15 [standard].
28C128 [ee] / 27128 [uv] (if modifying for channel double-up (VK2NAS mod)).
looks like these guys have been busy.
looks like BMARC members might have done something with it too.
There doesn't appear to be any method of serial programing the EEPROM, so it must obviously be removed to be programed and a lot of people already know what the EEPROM code is.
If I can get this information, I can do something completely different.
One of two things. The first is to make a PIC chip and a serial eeprom do the dirty work of an old fashioned parallel eeprom. The advantage to that is that you could program the radio with a serial cable.
The pic chip can be made just to accept simple command strings that you could send with a simple command line in dos/windows. Set them up in a batch file to bulk program a radio.
The second choice is to make it a digiscan type setup. It sounds complex but it's actually quite simple. The programing needs to be clever.
It would go something like this. The radio's eeprom config limits must be known first. The up/down buttons can be used to talk to the PIC.
The pic just looks for channel changes on the prom address lines.
Press the channel up/down and the PIC changes the frequency.
It might be harder to talk directly to the two digit LED display on the front panel. If that was possible, the frequency could be scrolled through the display. If not an external LCD display would make life very easy.
If you want to make it a long term project, I can help you the code and design. It doesn't appear hard to do, it would just take a little time.
Hi Trash,
no no no...I have the software, played with programming up my own images for many years, no worries there. it is the Philips properity programmer that is the missing bit. That was used to read the EPROM and would create the BIN, CHL & JOB files that where readiable but the FPP software and hence editable by the user. These devices are just not available and the user now has to build up their own personal image from scratch using the FPP software and burn using any old eprom programmer.
The main reason for wanting a little utility that would extract the info from the image file is for heavily modified non-standard FM900's, like one that are running on 50 MHz (E-Band) and even one I have seen working on 29 MHz (G-Band????). I doubt very much if the FPP software is able to produce images here and the eprom in these radios would heavily hand modified by the origional modifier, this is where a "decoding" utility would be advantages.
I have folders and folders of information on FM900 and have even palyed with the AFI900 software which is a fantastic modification of origional software adding many features.
Never really been interested in Bank switching.
And this is where a little "decode" utility would be very handy. The eprom locations for various features, channels, etc is well documentated, as is the channel information decoding method, it is combining it into a utility that remains to be done.Another method is to get two radios that are already different and comparing the differences in the eeproms, then changing the bytes and predicting the changes.
Did I send you the method to decode the frequency contained at various locations??
porkop
Basically trash, It would be great to have a utility that decoded the eprom image and below is how to do it by hand, one channel at a time.
porkop
The channels start at $1BE0.
Decode original string (FM906) as follows:
FC 8F C6 is the receive 6F 7F AE is the transmit
Because of the way that the synthesiser is fed serially with 4 bit bytes,
and in NEGATIVE logic the procedure is as follows:
FC 8F C6 eprom code
CF F8 6C reverse the nibbles
CF F8 EC add 8 (msb of the nybble '6' is set if not already set,
changing 6C to EC, the C is not required.
30 07 1 negate the remaining nybbles one at a time, drop the last
nybble (C)
17003 reverse the order of the nybbles Now we have the division
ratio.!!
425075 multiply by 25 ( 25khz steps)
425.075 mhz VCO frequency
446.475 mhz 21.4 mhz IF frequency added... this is the final freq
Now the transmit code
Note: the TX code is not actually used as the TX frequency offset is
always thwe RX frequency plus or minus the offset determined by the
xtal in the duplex add-on unit.
None the less:
6F 7F AE eprom code
F6 F7 EA reverse the nibbles
F6 F7 EA set the msb of the 'E' as for receive... no difference.. already
set!
09 08 1 negate the remaining nibbles one at a time, drop the last
nybble (A)
18090 reverse order of the numbers Now we have the division ratio.!!
452250 multiply by 25 ( 25 khz steps)
452.250 MHz TX freq
You will find if you decode the data and then SUBTRACT the IF frequency you
will get the same receive frequency.
EA 78 A6
AE 87 6A
AE 87 E
51 78 1
18715
467.875
446.475 MHZ 21.4 mhz SUBTRACTED in this case.
You will also need to change the location $1F3E to reflect the highest channel number.
As always, ANY change needs to have the eprom checksum adjusted.
This code is at $1F64. A simple add-type checksum is used.
Add value until checksum ends with FF.
The date of programming is at 1FE2.
In the fm92 models the channels start at $1BE8.
The fm91 has a capacity for 21 extra channels over the fm92.
Do you have a couple of raw eprom files you can send me ?
I'm guessing that's a BIN file, but the other files might be handy too.
pm me your email and I will attach one to a reply.
ok, got them, just been working through the data.
bit late tonight now.
Jeff,
join the FM900 yahoo group. lots of info there
__________________________________________________ __
Statistically, if you wait long enough, everything will happen!
Bookmarks