Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Serial number mapping to a flash memory address

Status
Not open for further replies.

jabidof

Member level 5
Member level 5
Joined
Jul 25, 2003
Messages
80
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
675
serial number flash memory

Hi there,

I have a 16F series microcontroller that receives serial numbers (barcode). All those number are unique and coded on 4 bytes.
I have an external flash memory with 16Mbits. I'd like to find a way to map the barcode serial number to a memory address.
The problem is that the flash memory device (from Atmel) has a particular structure to make the addressing efficient (from memory point of view).

So does anyone have an idea of how to map the BARCODE UID to a FLASH MEMORY ADDRESS using a 16F series microcontroller? I guess some kind of function based on the BARCODE UID will do the job but maybe one of you already solved that problem once :D

Thanks for any hints.
 

map address using flash

jabidof said:
I have an external flash memory with 16Mbits. I'd like to find a way to map the barcode serial number to a memory address.
I don't understand! Can you give an example?
 

flash code 2009 q3 serial

Sure :)

Imagine you scan a barcode and your MCU gets the following code in HEX:
0xC0 01 67

Now you have an external flash memory IC with 16Mbits of data.

The goal is to map the barcode just scanned (i.e. 0xC0 01 67) to a unique memory address of the flash IC and store a bit there.

Did I make it clearer?
 

flash memory serial number

Divide the code address by 8 to get the address and get the remainder to address the bit.
 

    jabidof

    Points: 2
    Helpful Answer Positive Rating
internal structure of flash memory ic

Good idea! What if we want to address 2 bits or more? We divide by 9, 10, etc?
 

flash number memory

Could you make one glossary-type clarification. It looks like you have a device under test (DUT), which has the 16F and the Atmel flash.

Q1. One serial number per DUT (e.g. DUT's own serial number of the device) or multiple serial numbers per DUT (e.g. DUT stores serial numbers of other objects)?

Q2. How is the DUT going to use the serial number after is was stored in Flash?

Q3. What do you mean by "mapping"? Usually mapping implies that two values that correspond to each-other have some numeric relationship. Is this interpretation close to yours? If one value is the serial number, than what's the other one?
 

how to find sn for my flash memory

Hello!

I don't get it. Let's clarify things.
What do you mean by "map the scanned barcode"? You want to check
if the bar code has already been stored, right? So basically you use the
barcode as an address and you store a bit at this address?

Let's make it clear: you have one MCU, one Atmel flash.
You scan a barcode, you get 0xC0 01 67. What are these spaces. You
meant 0x00C00167, right?

As suggested above, you should divide by 8 (right shift by 3 may be faster).
Let's suppose you have functions to write and also read a single byte to flash
defined as uint8 read_at(uint32 where) and write_at(uint32 where, uint8 what).

- use 2 variables add(21 bits) and val
add = (code >> 3) & 0x001FFFFF; // AND with a 21 bit value, just in case
val = (uint8)(code & 0x00000007); // AND with 0x07 for the 3 last bits.
then transform it to get one bit at the position indicated by val
bitval = 1<<val;

Now if you write val at add, you would do:

write_at(add, bitval).

But id you have 2 values in a sequence (for instance if your codes are
0x00000018 and 0x00000019), you should write bit 0 of byte 3 and bit
1 of byte 3. (0x18 is 00011000 in binary, therefore 00000011 when shifted
by 3).

The solution (supposing you have already written the 0x00000018 code bit:

orgbitval = read_at(3); // Get the value already stored
bitval = orgbitval | (1 << val); // Stores 0x01 | 0x02 = 0x03 in my example
write_at(3, bitval);

Then you will have 2 consecutive bits and the value 0x03 will be written at
byte 3.

That's it! Have fun!

Dora.



jabidof said:
Sure :)

Imagine you scan a barcode and your MCU gets the following code in HEX:
0xC0 01 67

Now you have an external flash memory IC with 16Mbits of data.

The goal is to map the barcode just scanned (i.e. 0xC0 01 67) to a unique memory address of the flash IC and store a bit there.

Did I make it clearer?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top