![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| I've been busy writing a clock and LCD program in asm for the 16F628 and after some kind I worked out it kept crashing due to its size. I loaded the program up in a simulator and the LCD displays what its supposed to. If however I make the program too big it keeps crashing. From the datasheet the program memory is 2K. I think I might have exceeded that but I don't know where to check? In MPLAB there's a memory usage guide, but program and data memory display 0. | |
| |
| | (permalink) | |
| Quote:
Or open the .LST file. Last edited by eng1; 28th January 2008 at 10:11 PM. | ||
| |
| | (permalink) |
| In MPLAB View->Memory Usage Gauge. | |
| |
| | (permalink) |
| Aghh thanks eng1. As easy as that That leads onto my second problem I've now taken Nigel's LCD tutorial and simulated the problem. I've put in a bunch of NOP's in the code and it falls over on the simulator. If its not memory related, what's causing it? I've attached the asm file. If someone could please have a look and tell me if it memory related or something more sinister. | |
| |
| | (permalink) | |
| Quote:
EDITED: typos corrected. Last edited by eng1; 28th January 2008 at 10:58 PM. | ||
| |
| | (permalink) |
| Holy smokes - it now works!! Now I'm confused - what difference does the table location make? Its all part of the same program memory isn't it? | |
| |
| | (permalink) |
| It looks like a 'page boundary' problem. See Microchip's Application Note 556. http://ww1.microchip.com/downloads/e...tes/00556e.pdf - link added. Last edited by eng1; 28th January 2008 at 11:25 PM. | |
| |
| | (permalink) |
| Thanks - I'll check out the note. You learn something new every day | |
| |
| | (permalink) |
| In MPLAB you can also use View->Program Memory. This is very crucial when dealing with tables. You can easily see when a table crosses a 256 byte boundary as an address rolls over from XFF to (X+1)FF. Wait until you come against the 2046 byte program boundary in larger sized word chips. God bless Microchip. | |
| |
| | (permalink) |
| A little bit of code I picked up somewhere: Code: Table1:
ADDWF PCL, f ;jump forward by value of W
retlw 'A'
retlw 'B'
retlw 'C'
retlw 'D'
retlw 'E'
retlw 'F' ;end of table
IF HIGH($)!=HIGH(Table1)
ERROR "End of table is not in same page as start of table"
ENDIF
__________________ --- The days of the digital watch are numbered. --- | |
| |
| | (permalink) |
| donniedj/kchriste - awesome thanks. That will really help me. Had no idea bout the page boundry. | |
| |
| | (permalink) |
| That is a good one kchriste. I wonder if that idea couldn't be expanded upon to conditionally assemble the extra instructions for "256 byte boundary tolerant" code only when it's actually needed? Mike | |
| |
| | (permalink) | |
| Quote:
Mike. | ||
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| Question about Inchworm+ | Quan | Micro Controllers | 54 | 28th October 2007 01:21 AM |
| memory addressing | samcheetah | General Electronics Chat | 4 | 29th September 2004 07:33 PM |
| PIC Micro Data vs Program Memory | CoTang | Micro Controllers | 4 | 14th January 2004 08:04 PM |
| 8051 "data" storage within program memory - how? | L0D|Mr_B | Micro Controllers | 1 | 11th January 2004 03:56 PM |
| Memory upgrades | electrogeek | General Electronics Chat | 1 | 19th January 2003 04:33 PM |