![]() | ![]() | ![]() |
| | |||||||
| 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) | ||
| Quote:
if you want to know how much memory is required you should let the compiler generate a list file, it tells you how much memory is required. You can also see it when you load the file into your programmer. Quote:
To make your code smaller you can use indirect adressing to clear a whole block of memory in a small loop. | |||
| |
| | (permalink) |
| it should fit because 1/4 of the hex file or assembled program are zeros.. this equals 1992 14 bit bytes.. so it should fit.. | |
| |
| | (permalink) |
| How many zero's are in it doesn't matter it's a intel hex file (do a google search). The data is stored as ascii wich makes it twice as large as it actually is. It also holds adress information for every 16 bytes of data wich doesn't get transferred. | |
| |
| | (permalink) |
| thanks a lot. I will change the direct initialization mode by indirect mode and the file size it makes feel light. (ligerito) | |
| |
| | (permalink) | |
| Quote:
but i was just looking at a 70 byte hex file dos file size...and it had 66 hex digits in it plus two coln's =68 bytes plus the carrage reuurn & line feed , makes 70 bytes.. but it wasnt 132 bytes long ..go figure... anyway i agree there are 6 bytes per line that dont get programmed into the part..counting the coln... what i was talking about was 2 bytes of hex file data , can fit into one 14 bit program memory location...so the 2048 program memory of the 16F870 could hold a hex file at least 4096 bytes long ... | ||
| |
| | (permalink) |
| Thanks a lot for your comments. I really appreciate that. I realized that I have a ommited a register. This is the Configuration Register, some parameters can be very easy deduced but others I really do not know: I have it in my _CONFIG _CONFIG (MSB) NC,NC,11 0111 x011 1010 (LSB) bit 13&12 =4&5 = 11, code protection off bit 11 = 1, in-circuit debugger disable bit 10 unimplemented bit 9 WRT = 1, unprotected program memory may be written to WHAT YOU RECOMMEND ME in bit 9 bit 8 CPD = 1 code protection OFF bit 7 LVP = X I do not know what's in here WHAT YOU RECOMMEND ME in bit 7 bit 6 BOREN = 0 disable bit 3 PWRTEN = 1 disable bit 2 WDTEN = 0 disable bit 1 y 0 Fosc1 y 2 = 10 HS oscillator I will use a burner called from "solaris digital" model S-103 so I think some control bits depends on it, isn't it? what you recommend me to do with the configuration words thanks in advanced | |
| |
| | (permalink) |
| bit 7 LVP: Low Voltage In-Circuit Serial Programming Enable bit 1 = RB3/PGM pin has PGM function, low voltage programming enabled 0 = RB3 is digital I/O, HV on MCLR must be used for programming.. low voltage programming is with the on chip serial port .. i assume that u are using MCLR to program the part so bit 7 is a zero | |
| |
| | (permalink) |
| i am pretty sure that bit 9 has to do with on chip serial programming.. also.. but i am not sure 100 % ...anyone else..?? bit 9 WRT: FLASH Program Memory Write Enable 1 = Unprotected program memory may be written to by EECON control 0 = Unprotected program memory may not be written to by EECON control | |
| |
| | (permalink) |
| the correct initialization of a program should be org 0x00 goto MAIN ;main program org 0x04 goto ISR ;interruption service routine MAIN ;main program begin here blablabla ISR ;ISR begin here blablabla RETFIE END I have seen that some people use org 0x05, does anyone know why? I have seen it from Nigel's programs and I really do not undestand why ORG 0x00 is sometimes 0x20 for example. is it really important, for the ISR? I have my program finished, but when I simulate it in the MPLAB, the TMR0, is not reloaded, does I need to reload it at the end of the ISR before exit? before bcf INTCON T0IF | |
| |
| | (permalink) | ||
| Quote:
Quote:
| |||
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| here is the code, well I would like to know if there is any observation that can be important to change. For example the definitions of goto's in the ISR routine, and how about the complexity of the ISR routine, and some others at the begining of the code, like ORG 0x00, ORG 0x05, ORG 0x04 well, this code should done the following read 3dip switches at RB7,6,5 111, set a delay of 20ms 110, set a delay of 100ms 101, set a delay of 300ms 100, set a delay of 500ms 011, set a delay of 1000ms=1sec x, don't care x x RB4, define a manual mode or automatic mode, auto=1 manual=0 RB3 and 2 11 set the ADC to detect 1.25v aprox 10 set the ADC to detect 2.5v 01 set the ADC to detect 3.25v 00 x RB0 is an external interrupt that will increment C_DF if C_DF =>31 the system will stop to enclave AN0 is the analog input RA1, led system on RA2, led TM, a TM event occurs RA3, LED DF, a DF event occurs RA4, turns on a relay for about 50ms to close an interruptor RA5, turns on a relay for about 50ms to open an interruptor TM events occurs without notice, so by polling the firmware a TM event is detected I think that's all, see you | |
| |
| | (permalink) |
| thanks ..i'm looking at it now.. | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| thanks to all, so in other words it is ok, isn't it? | |
| |