void datashift(unsigned long value_)
{
unsigned long i;
for(i = 0x800000; i; i >>= 1)
{
if (value_ & i) DataPin = 1;
else DataPin = 0;
ClockPin = 1;
ClockPin = 0;
}
// send another clock pulse
LatchPin = 1;
LatchPin = 0;
}
void read(unsigned long addres) {
unsigned long p;
unsigned long u;
while(Hid_Write(&writebuff, 64)){
for (u=0; u<=64; u++){
for (p=0; p<=addres; p++){
datashift(p);
writebuff[p] = PORTB;
}
}
}
void main(void){
unsigned char t;
init();
/*for(t=0;t<=65535;++t){
datashift(t);
delay_us(2000);
}*/
HID_Enable(&readbuff,&writebuff); // Enable HID communication while(1){
while(!HID_Read());
switch(readbuff[0]){
case 'j': read(8192); break;
writebuff[0] = 'o';
writebuff[1] = 'k';
default: HID_Write(&writebuff,64);
}
}
any help to read 8k from portb write 64byte to reach 8192 thx
8k address 8192 read portb stat 64byte hid_write(&buffer, 64
-
- Posts: 4
- Joined: 26 Dec 2019 15:10
- stefan.filipovic
- mikroElektronika team
- Posts: 1135
- Joined: 18 Dec 2018 10:30
Re: 8k address 8192 read portb stat 64byte hid_write(&buffer
Hi,
Welcome to the MikroE forum.
I'm not quite sure if I understand correctly what's your final goal with this code.
Could you please provide me with more details about that?
Kind regards,
Welcome to the MikroE forum.
I'm not quite sure if I understand correctly what's your final goal with this code.
Could you please provide me with more details about that?
Kind regards,
Stefan Filipović
-
- Posts: 4
- Joined: 26 Dec 2019 15:10
Re: 8k address 8192 read portb stat 64byte hid_write(&buffer
i devlop with c# im learning parallel data transfer im using 74hc595 serial in parallel out for address and i use usb hid for transfer data
when i read 64byte bufferhid with c# i read 1byte from eeprom this take more time and if i read all buffer hid 64byte inside data read from eeprom go more fast thx sorry for my english
this is my fuction c# to extract 1byte from 64byte and copy them fo file this take more time.
while ((count = dev.fileStream.Read(read, 0, 65)) > 0)
{
Array.Copy(read, 1, inc, 0, 1); <== 1byte from incoming data
LogFile.Write(inc, 0, inc.Length);
//count += inc.Length;
if (LogFile.Length == total_size_in_byte)
{
LogFile.Flush();
LogFile.Close();
break;
}
//else
//{
// // textBox1.Invoke((MethodInvoker)delegate { textBox1.AppendText(Environment.NewLine + BitConverter.ToString(inc)); });
//}
}
when i read 64byte bufferhid with c# i read 1byte from eeprom this take more time and if i read all buffer hid 64byte inside data read from eeprom go more fast thx sorry for my english
this is my fuction c# to extract 1byte from 64byte and copy them fo file this take more time.
while ((count = dev.fileStream.Read(read, 0, 65)) > 0)
{
Array.Copy(read, 1, inc, 0, 1); <== 1byte from incoming data
LogFile.Write(inc, 0, inc.Length);
//count += inc.Length;
if (LogFile.Length == total_size_in_byte)
{
LogFile.Flush();
LogFile.Close();
break;
}
//else
//{
// // textBox1.Invoke((MethodInvoker)delegate { textBox1.AppendText(Environment.NewLine + BitConverter.ToString(inc)); });
//}
}
- Attachments
-
- reading 27c64 with usb hid
- Sans titre.png (150.05 KiB) Viewed 2985 times
- stefan.filipovic
- mikroElektronika team
- Posts: 1135
- Joined: 18 Dec 2018 10:30
Re: 8k address 8192 read portb stat 64byte hid_write(&buffer
Hi,
We do not work with C#, we are working with mikroC/Basic/Pascal only, so, I'm afraid I cannot assist you in this matter.
Thank you for understanding.
Kind regards,
We do not work with C#, we are working with mikroC/Basic/Pascal only, so, I'm afraid I cannot assist you in this matter.
Thank you for understanding.
Kind regards,
Stefan Filipović
-
- Posts: 4
- Joined: 26 Dec 2019 15:10
Re: 8k address 8192 read portb stat 64byte hid_write(&buffer
Im not talking about c# im talking about microC
-
- Posts: 4
- Joined: 26 Dec 2019 15:10
Re: 8k address 8192 read portb stat 64byte hid_write(&buffer
my project is reading writing 28f400bve is 4mbit 512kb im using pic18f4550 24.474mhz
this is my code for reading :
void init(){
//INTCON2.RBPU = 1;
ADCON1 = 0x0F; // page 268, disable analaog
CMCON = 0x07; // disable comparator
INTCON2 = 0x80; // disable pull up in port b
ce_dir=0;
oe_dir=0;
we_dir=0;
TRISB = 0xFF; // set PORTB as input
DataPin_dir =0;
ClockPin_dir=0;
LatchPin_dir=0;
USB_Buffer_Clear();
delay_ms(200);
flash_ctrl_deselect();
HID_Enable(&readbuff,&writebuff); // Enable HID communication while(1){
delay_ms(2000);
ce_dir =0;//digitalWrite(15, HIGH); //CE
we_dir=0;//digitalWrite(13, HIGH); //WE
oe_dir=0;//digitalWrite(14, HIGH); //OE
USB_Buffer_Clear();
}
unsigned char readEEPROMbyte(unsigned long h) {
asm{MOVLW 0
MOVWF PORTB}
delay_us(320);
datashift(h);
delay_us(400);
data_re = PORTB;
delay_us(450);
return data_re;
delay_us(450);
}
void read_content(unsigned long add){
unsigned long base=0;
unsigned long offset;
for(base=0;base<add;base+=64)
{
for(offset=0;offset<64;offset+=1){
writebuff[offset] = readEEPROMbyte(base + offset);
}
HID_Write(&writebuff, 64);
}
}
give random wrong reading, i dont know if is delay ,any help welcome thx
this is my code for reading :
void init(){
//INTCON2.RBPU = 1;
ADCON1 = 0x0F; // page 268, disable analaog
CMCON = 0x07; // disable comparator
INTCON2 = 0x80; // disable pull up in port b
ce_dir=0;
oe_dir=0;
we_dir=0;
TRISB = 0xFF; // set PORTB as input
DataPin_dir =0;
ClockPin_dir=0;
LatchPin_dir=0;
USB_Buffer_Clear();
delay_ms(200);
flash_ctrl_deselect();
HID_Enable(&readbuff,&writebuff); // Enable HID communication while(1){
delay_ms(2000);
ce_dir =0;//digitalWrite(15, HIGH); //CE
we_dir=0;//digitalWrite(13, HIGH); //WE
oe_dir=0;//digitalWrite(14, HIGH); //OE
USB_Buffer_Clear();
}
unsigned char readEEPROMbyte(unsigned long h) {
asm{MOVLW 0
MOVWF PORTB}
delay_us(320);
datashift(h);
delay_us(400);
data_re = PORTB;
delay_us(450);
return data_re;
delay_us(450);
}
void read_content(unsigned long add){
unsigned long base=0;
unsigned long offset;
for(base=0;base<add;base+=64)
{
for(offset=0;offset<64;offset+=1){
writebuff[offset] = readEEPROMbyte(base + offset);
}
HID_Write(&writebuff, 64);
}
}
give random wrong reading, i dont know if is delay ,any help welcome thx