Hi Melanie
Is this your code space solution ?
I can't understand the final part !
Please explain me !
Thank you very much
Don Mario
Hi Melanie
Is this your code space solution ?
I can't understand the final part !
Please explain me !
Thank you very much
Don Mario
Hello,
This project uses ports A-B and C to drive a display containing 21 LED's.
To generate the patterns I started with arrays but quickly ran out of space. The following is a partial sample of an array pattern setup. Using binary helps to visualize what the pattern will look like.
ARRAYDATA5:
ARRAY5C[0]=%00000111:ARRAY5B[0]= %00000111:ARRAY5A[0]=%000001
ARRAY5C[1]=%00001110:ARRAY5B[1]= %00001110:ARRAY5A[1]=%000011
ARRAY5C[2]=%00011100:ARRAY5B[2]= %00011100:ARRAY5A[2]=%000111
ARRAY5C[3]=%00111000:ARRAY5B[3]= %00111000:ARRAY5A[3]=%001110
.
.
.
.
RETURN
I looked at the code space playground thread and got some good results, but not perfect. I disabled the LCD code and instead have the data output to portb with led monitors. I put in a 2 second delay between each read.
Decimal DB values give the expected display results however using binary values produces some extra bits within the expected pattern. I tried 14 bits and 8 bits and using the % symbol which the compiler dosen't like.
test pattern does not work properly
Asm
CODE 7190
DB 00000000000001
DB 00000000000010
DB 00000000000100
DB 00000000001000
DB 00000000010000
DB 00000000100000
DB 0
endasm
........................................
this code works
Asm
CODE 7190
DB 1
DB 2
DB 4
DB 8
DB 16
DB 0
endasm
Is there something wrong with entering binary values this way? I must be able to develop patterns in binary. It is just too hard to visualize decimal values.
Maybe I could use the arrays just to develop the patterns then have some utility program convert binary to decimal and generate "DB (decimal}" code somehow. This would make things easier. Any ideas?
Thanks
"Weaseling out of things is important to learn. It's what separates us from the animals... Except the weasel."
Last edited by Homerclese; - 8th October 2005 at 01:32.
if i can suggest one thing, use the internal EEPROM of your PIC if he have one. Really easy to do with DATA to load your value, later use READ to read your aray from the internal EEPROM.
Can you start another thread and post your whole code? That way we will be able to point you some idea.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi,
Yes I was using EEPROM for array storage but the 16f877 has only 256 bytes available. I will need about 4k just for pattern storage. That is why I'm looking at using the code program space. The problem seems to be my use of binary data input. Here's the code i'm using for testing.
' PCode.bas
' Quick Demo Program
' showing how you can play with
' Program Code Space
Define debug_pacing 1000 'serial setup
Define debug_reg porta
Define debug_bit 0
Define debug_baud 2400
Define debug_mode 1
TRISB= %00000000
TRISa= %00000 '
'
' RAM Assignments & Variables
' ---------------------------
PCAddress var WORD ' Used to determine ADDRESS of Data
' within Program Code space
PCData var BYTE ' Data Variable - in this example a BYTE
' but could be a WORD as each memory
' address is capable of storing 14-bits
PCWord var WORD
'
' Start Program
' =============
Pause 2000
DoitAgain:
PCAddress=7190 ' Pointer to start of Data area
'
' Read & Display till we get a stop character
' -------------------------------------------
ReadCodeLoop:
READCODE PCAddress,PCData ' Sequentially read bytes
If PCData>0 then ' Until a Stop character is found
debug "ADD=", dec pcaddress 'lcd display
debug 254,192
debug "DAT=", dec pcdata
PCAddress=PCAddress+1 ' Remembering to increment our address
portB=pcdata 'output data to portB LEDs
Pause 300
Goto ReadCodeLoop
endif
Pause 50
Goto DoitAgain
End
Asm
CODE 7190
DB 00000001
DB 00000010
DB 00000100
DB 00001000
DB 00010000
DB 00100000
DB 01000000
DB 10000000
DB 0
Endasm
........................
RESULTS
debug LCD readout values
00000001 = 1 OK
00000010 = 10 NG
00000100 = 100 NG
00001000 = 232 NG
00010000 = 16 OK
00100000 = 160 NG
01000000 = 64 OK
10000000 = 128 OK
Last edited by Homerclese; - 9th October 2005 at 01:23.
The first method shown work only on 16F87X flash memory PICs as far as i know.
The second method posted that used PEEKCODE and POKECODE works great in smaller pics.
...for the ones that didn'd get it in the first example
--[To Write]--
Just include after the END tag of the program:
POKECODE @[start address],[byte0],[byte1],[byte2]....(up to 79)
(note: start address must be bigger than your program size, and the command only works when programming the pic)
--[To Read]--
(use something like...)
OUT var byte
y var word
For y = [start address] to [start address + nºbytes]
PEEKCODE y, OUT
Next y
hope it helps...
Last edited by El_AMPo; - 17th January 2006 at 06:50.
How do I determine the free memory space?
PBP manual: The listing file may be examined to determine program addresses.
I've appended a test list file (original .LST file, renamed .TXT for uploading) generated by MCS.
How must I read & understand this file?
PIC16F690's Memory Map looks like this:
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2728&stc=1&d=121534385 0">
Roger
Hi, Roger
MPLAB, Program window ... does it sound something to You ???
... Lol
With MCS, have a look to the SMALL characters at the bottom left part of your screen ...
...
Alain
Last edited by Acetronics2; - 6th July 2008 at 13:02.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks