PIC16LF628 Microcontroller Program Memory - Page 1
Forum section: electronics / beginners

author: christos
author_rank: Regular Contributor
timestamp: September 07, 2017, 03:45:53 pm
content: Hello,,i cant understand how many Kbit of program memory the PIC16LF628 Microcontroller have? What does 2048 x 14 Flash Program mean?Thx!!

author: NivagSwerdna
author_rank: Super Contributor
timestamp: September 07, 2017, 03:50:55 pm
content: That PIC has a 14-bit instruction word. In flash you get 2048 of them.EEPROM and RAM are 8-bit wide.

author: Ian.M
author_rank: Super Contributor
timestamp: September 07, 2017, 03:52:12 pm
content: The total number of bits or bytes of FLASH isn't a useful metric for an application programmer*. Far more useful is knowing that's 2048 instructions, and that if you are storing data tables in FLASH, it takes a full 14 bit instruction word to store a single data byte using a RETLW instruction.* OTOH its essential knowledge if you are developing any component of a PIC16 toolchain.

author: christos
author_rank: Regular Contributor
timestamp: September 07, 2017, 03:53:16 pm
content: but how can i calculate it to find how many Kbits this pic has?

author: stj
author_rank: Super Contributor
timestamp: September 07, 2017, 03:55:54 pm
content: 2048 x 14

author: christos
author_rank: Regular Contributor
timestamp: September 07, 2017, 03:57:17 pm
content: but on the pdf it says its 3.5kbit 2048x14 is 28.672 bits

author: Ian.M
author_rank: Super Contributor
timestamp: September 07, 2017, 04:04:43 pm
content: Quote from: christos on September 07, 2017, 03:53:16 pmWhy would you even want to? Are you going to include the EEPROM or the RAM? What about the CONFIG bits?2Kwords * 14/8 = 3.5KB, (Kilobytes, not Kilobits)Quote from: stj on September 07, 2017, 03:55:54 pmEntirely correct for the number of Kbits of FLASH program memory, but absolutely useless except possibly to toolchain developers.

author: macboy
author_rank: Super Contributor
timestamp: September 08, 2017, 02:03:09 pm
content: Quote from: christos on September 07, 2017, 03:57:17 pmYou are confusing your bits and bytes. 28672 b = 3584 B = exactly 3.5 kB.

author: Ian.M
author_rank: Super Contributor
timestamp: September 08, 2017, 02:10:11 pm
content: <pedant>kB is itself confusing. It should be KiB. Seehttps://en.wikipedia.org/wiki/Binary_prefix</pedant>

author: KL27x
author_rank: Super Contributor
timestamp: September 09, 2017, 05:17:48 am
content: "but how can i calculate it to find how many Kbits this pic has?"2048 Words * (14 bits/1 Words) * (1 kilo bits/1000 bits) * = 28.672 kilo bits.28.672 kilo bits * (1000 bits/1 kilo bits) * (1 byte/8 bits) * (1KB/1024 bytes) = 3.5KB (kilo bytes)W/e you call it, you get 2048 instructions to work with. If it was a 16 bit architecture, 3.5KB of program memory would only be 1792 instructions... but that is an odd number, and no one would make one with that exact amount of memory. (A 16bit architecture with 2024 instructions/words would be described as having 4KB of program memory.)3.5KB sounds more impressive than 2 "kilowords." Or would it be 2.048 "kilowords?"

author: christos
author_rank: Regular Contributor
timestamp: September 09, 2017, 09:11:33 am
content: well,,my bad,,i thought the 3.5kB was kbits and wondering how that number came fromthx all for the help!!!