PDA

View Full Version : Size code



vicce67
- 5th April 2011, 16:42
Dear Friends,

I Use 0 16f877 7 years ago with pbp.

now I need more space and I opted for the 18f4520.

when I compile in the 16f877 the hex it is with 8056 bytes and in the 18f4520 it is with 14450.

how is it so big in the 18f4520?

what do make to reduce the size of the generated code?

use the pbp 2.47 and mcs 2.3.0.0.

the initial header of the 877

HS_OSC, WDT_ON, PWRT_ON, BOD_ON, LVP_OFF, PROTECT_ON,WRT_OFF

in advance thankful,

vicce.

Acetronics2
- 5th April 2011, 19:15
Hi,

are you sure the numbers apply to same "memory units" ??? :rolleyes:

Alain

Pimentel
- 6th April 2011, 12:04
The PIC18F4520 have X Kbytes of Flash memory and can store up to Y single-word instructions! Look the datasheet.
When I migrated to 16f877 to 18f452 I was think in 2x the memory of the 16f877, then I perceved it also. Is normal, but I don't know to explain better, sorry!

Pimentel

vicce67
- 6th April 2011, 15:43
Ok Pimentel obrigado,

Vi que voce e' brasileiro,

Entao o final da memoria apontada no compilador pelo mcs nao 'e 16384 para o 18f452 e sim 32768.esta correto isto ?

Pimentel
- 7th April 2011, 01:40
Ok Pimentel obrigado,

Vi que voce e' brasileiro,

Entao o final da memoria apontada no compilador pelo mcs nao 'e 16384 para o 18f452 e sim 32768.esta correto isto ?


Fala aí colega, blz?
acho que é isso sim ( no datasheet diz 32k bytes de flash (32768 se vc fez as contas,rsrsrs) e 16384 #single word instructions). No MCS deve mostrar words usadas então acho que é isso sim!

É mais ou menos por aí...eu tinha uma aplicação usando um 16F877A que tem 8k de flash, mas eu precisava de mais memória. Então migrei p/ o 18F452 e esperava que o mesmo código que eu tinha no 877A ficasse com o mesmo tamanho e p/ minha surpresa qdo compilei notei que tinha quase 16k...daí lendo o datasheet vi esse lance de single word...e já viu né. Vc deve ter tido essa mesma dúvida... eu acabei de fazer um teste...eu tenho um programa usando o 18f452 que ao compilar mostra 5278 words usadas....daí eu mudei p/ PIC 16F877A e compilei de novo...deu 3124 words. Não sei se ajudou mas é isso mesmo...denorex...parece mas não é, kkkk
abraço

Pimentel