Pages: [1]   Go Down
Author Topic: Serial data at 57600  (Read 407 times)
0 Members and 1 Guest are viewing this topic.
NZ
Offline Offline
Newbie
*
Karma: 0
Posts: 40
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying read data at 57600 baud, I want to read serial data until read a null character.. and separate it
my tag is (HEX): 9062FD59, At the moment just I can read on serial monitor:
FFFFFF90
0
0
0
FFFFFF90
62
0
0
FFFFFF90
62
FFFFFFFD
0
FFFFFF90
62
FFFFFFFD
59

Code:
char code[20];

int  val = 0;
int bytesread = 0;
int i = 0;

void setup(){
  Serial.begin(57600);
}

void loop()
{
   if (Serial.available() > 0 )
   bytesread = 0;
  
   while(bytesread < 6)
   {
     if (Serial.available() > 0)
     {
      val  = Serial.read();
      code[i] = val;
      i++;
      if (code[i]= '\0');
      {
      break;
      
      }
     }
     //dont use here
   }
 Serial.println(code[0], HEX);
 Serial.println(code[1], HEX);
 Serial.println(code[2], HEX);
 Serial.println(code[3], HEX);
}

my reader is connected to Max232 and from it to Rx ArduinoUno, and I have ground commun
the reader r10 works fine connect to max323 and direct to PC using converser serial-usb
reader Iclass https://www.hidglobal.com/products/readers/iclass/r10
« Last Edit: April 21, 2013, 04:39:24 am by f0raster0 » Logged

keep calm & carry on

New Jersey
Online Online
Faraday Member
**
Karma: 67
Posts: 3700
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The arduino can manage that baud rate. Your code suggests that you have your HID reader attached to the hardware serial pins and you're trying to read the result using the same pins on the serial monitor. Is that what you have?
Logged

Pages: [1]   Go Up
Jump to: