Hi,
Im working with EEPROM now, i send data though serial port to it, and EEPROM waits from data 24 bits, the first 8bits - EEPROM understand as address where to write sending data, the antoher 16bits - its what to write.
So im confused how make it happen in C# code.
Update:
Ok, im using AVR BASCOM to compile on mk, but problem not in bascom,
for exmaple, command inputbit will receive value from UART and assign it to variable
the Inputbin will wait for 3 bytes
1 byte = address (dim as byte)
2 bytes = data (dim as word) = 2 bytes
' 2 bytes becouse word = 16bits
For exmaple i want to write "4001" to 25 memory cell in EEPROM.
Data_tx = 4001
Addr = 25
this numbers on binery are
SB OP address data not used
1 01 011001 0000111110100001 0000000
25 4001 dont care
SB, OP = start bit and op code it equals 101 due to EEPROM datasheet, after them going my address which consist of 6 bits, then 2 bytes data that we want to write.(cuz i have 64x16 wire)
If i send for exmaple 1,
serialPort1.Write("\u0005");
and write the address in my AVR compiler( im using AVR BASCOM btw), for exmaple in Fifth memory cell, it will write 0000 0000 0000 0001 to 5th memory cell. But i need to not write address or data by my own on compiler code. I need to send it by Windows forms utility.
THerefore i need to send the address which equals 6 bits and address which equals 16 bits, its how i understand it
What I have tried:
private void button1_Click(object sender, EventArgs e)
{
serialPort1.Write("\u0001");
serialPort1.Write(Convert.ToString(0x05));
}