PDA

View Full Version : Conversion of bytes to word



selbstdual
- 6th February 2007, 15:01
Hello. In short:

-converted word to write it with



WRITE 0, WValue.BYTE0
WRITE 1, WValue.BYTE1


-numbers are written to the pic i can see them having read it with my programmer

-how to convert these two hex-values to one word again ?

Regards

selbstdual

mister_e
- 6th February 2007, 16:09
the same way dude.


READ 0, WValue.BYTE0
READ 1, WValue.BYTE1

selbstdual
- 6th February 2007, 18:47
No. I want to see a value between 0 and 65536.

Regards


PS: Don't call me "dude".

Acetronics2
- 6th February 2007, 19:22
<< No. I want to see a value between 0 and 65536. >>

I suppose it must be a word ???


<< PS: Don't call me "dude". >>

Ok, no problem, we won't any more, dude.

Alain

keithdoxey
- 6th February 2007, 19:55
No. I want to see a value between 0 and 65536.


Not possible Im afraid.

Although having declared Wvalue as a Word and read the upper and lower bytes back into it as per Mister_E's example, you should find that Wvalue contains a value between 0 and 65535.

You can output this on a display with

LCDout DEC Wvalue
LCDout HEX Wvalue

or any of the other many ways that PBP can format numbers.

selbstdual
- 6th February 2007, 21:32
In short:

-let pic collect data, write to eeprom
-put pic in programmer
-read pic's eeprom
-shows something like

2100: E0 02 1E 04 74 04 C1 05 à...t.Á.
2108: FC 06 5D 06 C5 08 0F 08 ü.].Å...
2110: E9 07 95 09 76 0A E1 09 é.•.v.á.
....

-means: E0 02 is one pair, 1E 04 is the next one and so on
-want to see a number between 0 and 65K instead of pairs like "E0 02".

skimask
- 6th February 2007, 23:36
No. I want to see a value between 0 and 65536.

Regards


PS: Don't call me "dude".

Well, dude, you won't see 65536 represented in a standard word. You'll have to use 17 bits instead of 16 to get 65536.

Acetronics2
- 7th February 2007, 09:52
A good question could be WHAT do you want to use to read your EEPROM ???

- LCD DISPLAY : Mr E Gave you the answer ...

- IDE : ah ...yes, maybe here we are !!!

I use MPLAB, and ... I use a side calculator ( Win.calc or here Casio Fx 880 ) !!!

No Other way in MPLAB ...

Alain

selbstdual
- 7th February 2007, 12:44
You couldn't even distinguish a chair from a table and would sit on the table while wondering how to eat on the chair. This is great for comedy.

skimask
- 7th February 2007, 13:15
You couldn't even distinguish a chair from a table and would sit on the table while wondering how to eat on the chair. This is great for comedy.

What's wrong with that?
Have you defined the height of the table and the chair? I think not...
Nor have you defined the PIC you are using, the version of PBP, which pages of the PBP manual you have looked at, which datasheets you have downloaded and studied, any websites you may have visited for information on some basic programming exercises...the list goes on...

Acetronics2
- 7th February 2007, 14:00
You couldn't even distinguish a chair from a table and would sit on the table while wondering how to eat on the chair. This is great for comedy.

1) a Fair answer to those who can't follow your "High level Brain" wouldn't be too much, moreover it could show you're a bit clever.

2) The last program I wrote kept side by side bits, Bytes and Words in the EEPROM ... How do you think your IDE could know by itself where are the different variable kinds ???

3) Try to learn how to use the WRITECODE and READCODE function ( with the convenient PIC !!! ) ... If his majesty would dare !!! ... dude.

4) another solution is to export the EEPROM content as a text File ... and decode it with an Excel sheet ( using VB Macros ...).

'Have to Learn a bit before wanting to seat at the PIC Gurus table. ( I just serve the wine there ... and I'm really proud of it !!! )

Alain

Robson
- 18th August 2007, 22:21
READ 0, WValue.BYTE0
READ 1, WValue.BYTE1

WVValue.BYTE0 = WVValue.BYTE0 * $100
WVDVal = WVValue.BYTE0 + WVValue.BYTE1