View Single Post
  #1   Spotlight this post!  
Unread 23-01-2008, 00:07
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Does reading from the serial port work?

With a fresh crop of beginning programmers on our team this year, we decided EasyC was what we'd use. Alas, a lot of my accumulated tools and tricks didn't quite make the transition, and I'm trying to reimplement a few of them.

Specifically, I want to implement something like the menus in Kevin Watson's "Bells & Whistles" camera code last year. I've found references to ReadSerialPortOne() and tried to use it, but it doesn't seem to work. Here's the code I put in a fresh OperatorControl function:
Code:
unsigned char keypress;
keypress = ReadSerialPortOne();
if (keypress != 0)
{
   WriteSerialPortOne(keypress);
}
I expect that to echo anything I type at the terminal. What I get is nothing. I've tried HyperTerminal instead of the EasyC Pro Terminal window, with no change. I know the terminal itself is working, as I can see the IFI> prompt show up when I reset the Robot Controller. I have the RC and OI tethered. While trying to figure out what wasn't working, I added a timer and called WriteSerialPortOne(65) every 100 milliseconds, and saw an "A" show up ten times a second, so I know the code is running.

What am I doing wrong?