| Electronics > Beginners |
| Assembly code Help! PIC16F57 |
| << < (24/32) > >> |
| rstofer:
One of the problems with the mid-range PIC, using assembly language, is paging. I have no idea how long the code is for this project but if you start to approach 2k, you need to figure out how to do paging. It's truly a PITA. http://www.piclist.com/techref/microchip/pages.htm An example might be a lookup table that crosses a 2k boundary. You can get to one end of the table but when you try to address the far end, in the next bank, what you really get is a wrap-around in the currently addressed bank. And that is usually trash! Hint: If you are going to exceed 2k anyway, start your tables at the beginning of a new page. You have to worry about PCLATH but you would anyway. What you don't want is to have the tables cross a boundary. Banking is a similar problem for variables. You can only reach the currently addressed bank and if your variable is in another bank, you have to get involved with BANKSEL. https://www.rs-online.com/designspark/the-curse-of-the-microchip-banksel--pagesel The mid-range PICs are truly a PITA. That's one reason why people like the AVR chips. It has a nice, regular, architecture with no paging or banking required. It also has a much larger instruction set and this can be either fantastic or a lot more work. AVR chips work a lot better with C, hence the popularity of the Arduino and the ATmega328. |
| KL27x:
16F57 isn't even a midrange PIC; it's baseline. Pages are only 2 address bytes long, lol. So it's not 2k per page, it's 0.5k. Code is already spanning all 4 pages of program space. This device has no interrupts and a 2 deep stack! --- Quote ---start your tables at the beginning of a new page. You have to worry about PCLATH but you would anyway. What you don't want is to have the tables cross a boundary. --- End quote --- PIC is worse than that, even. For pointer manipulation, the table must not cross a single address byte or it wraps back to the beginning of that byte block. Tables in this code all start and finish between 200f and 299f 200h and 2FFh, so no problem, there. *For larger tables you could potentially put them in data memory in an enhanced midrange PIC, where all banks are accessible in a continuous linear block with INDF. |
| Electrofinn:
Just having a last ditch effort here, gone back to basics. trying original source code with some of your earlier steps with bitmasks on tables. I'll tell ya, if I had the money! I'd offer you a large sum. the stuff you guy's have mentioned is like a university course worth! you may say I shouldn't doubt myself but...too late! lol |O |
| KL27x:
--- Quote ---I'll tell ya, if I had the money! I'd offer you a large sum. --- End quote --- Oh, the irony. Some of the other PIC assembly coders on the forum laugh off my suggestions/practices and more or less think I'm a total idiot. :-// |
| Electrofinn:
Lmao really! Well if they think they're that good they could sort this code out without suggesting I change the pic or some other drastic measure couldn't they lol after all a pair of novices managed it in the end on the same hardware. I already know you could do it, it's just almost impossible to sort out over the Internet and without the hardware in front of you, Add to that it's just way too much work to ask of someone that I can't pay. Nah, you know your stuff, no argument here. :-+ |
| Navigation |
| Message Index |
| Next page |
| Previous page |