-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On a PIC18, code ROM is organized into words, each of which is two bytes long. In an ordinary CODE section, the assembler ensures every line starts at an even address; it does this by filling an extra zero byte if the previous line ended off-by-one. Thus, your example of one byte per line will result in each byte being followed by the implicitly-inserted zero. To fix this, put the table inside a CODE_PACK section. This is obviously not the only problem, since you say there isn't anything at all after the first byte for a whole 20 bytes, but this is definitely a problem. Also, consider looking at the listing file generated by the linker. This will show the exact ROM addresses where your table is spat out, along with the data bytes stored into it. Chris On Mon, 15 Feb 2010 18:43:08 -0500 Josh Koffman wrote: > Hi all. Well, now that I'm on my way converting binary to BCD, I'll > next need to convert from BCD to 7 segment display. I will do this > with a lookup table. In order to make my code easier to read, I tried > to put each value in the table on its own line. For example: > > db b'01010101' ; some character > db b'10101010' ; some other character > db b'111111111' ; yet another character > > However when I tried to use this, it didn't seem to work. I only > seemed to be able to return a 0 for anything after the first entry. > Switching to: > db b'01010101', b'10101010', b'1111111' > seemed to make the difference. I admit I'm not really sure why though. > The table has about 20 entries, so even if I was having some problem > with bytes vs words I should have had some garbage, not all zeros. > > I'm sure I'm missing something simple here, but I can't figure it out! > All of the examples I have managed to find list all the data in the > same db line. This seems really unwieldy for a large table though. > This is on a PIC18F by the way. > > Thoughts? > > Josh -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: GnuPT 2.7.2 iEYEARECAAYFAkt6LuIACgkQXUF6hOTGP7dVkACfaue6JcOWt3akQI4dU/otUc9x XZAAoJ3sHpP9rg4bDvYOG7tFQUQUfmHa =bucI -----END PGP SIGNATURE----- -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist