Go to Post The teams that do the right thing for the sake of doing the right thing, and for believing in the message of FIRST deserve to be recognized. - Madison [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 08-02-2012, 14:11
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Usage of serial port on cRio

We're having a lot of difficulty using the serial port on the cRio to interface with devices.
  • Console out switch is off.
  • Tried with an RS232 compass sensor
  • Tried with an Arduino spitting out a single byte in a loop
  • Confirmed correct serial data on both devices with a logic analyzer and Portmon

When running some very simple code (I sure hope I'm just doing something wrong) - the cRio will read some data (slowly) and then crash.

Code:
virtual void TeleopPeriodic() {
  int n = com.GetBytesReceived();
  if (n > 0) {
      char *buffer;
      printf("Reading\n");
      com.Read(buffer, n);
      printf("Done reading\n");

      for (int i = 0; i < n; i++) {
          printf("%d 0x%X\n", n, buffer[i]);
      }
}
Screenshot attached.
Attached Thumbnails
Click image for larger version

Name:	machine_check_error.png
Views:	29
Size:	55.1 KB
ID:	11800  
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 17:33.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi