Showing posts with label robot. Show all posts
Showing posts with label robot. Show all posts

Sunday, August 1, 2010

C code: Some weirdness with 'strcmp' when using Interrupts with UART

Below is an excerpt from the post I put on AVR Freaks under AVR Forum about this weird problem involving the 'strmp' library function. This was burning my metallic butt all week. I have a simple workaround to continue coding for now. The complete post with test code and display output can be see at this [link] If you night have any suggestions feel free to post here or on AVR Freaks.
I posted a problem about 'strcmp' in another post earlier today. I programming our robot to use a command line interface to accept commands over the serial port. This is wired to usart1 on a ATMega128 on a Olimex AVR-MT-128 controller with a DB-9 onboard.

Below is each test code and output showing that I get two diff results when using 'strcmp'. I don't know why this is happening.
Basically, 'strcmp' is supposed to return a 0 when the compare is true. This does happen when using 'fgets' to enter a string.

But in my other test code, where I use interrupts on the usart, the 'strcmp' *does not* return a 0 when the compare is true. Instead, it returns a 13. So I had to edit my test code in order to get it to work.

I hope somebody knows about this. In the meantime, I have to use '13' instead of '0' when using 'strcmp', this is how I have to get my robot to work properly.

Tuesday, July 27, 2010

Welcome to a new Blog for our Pittsburgh Robotics Club

Welcome to a new Blog for our Pittsburgh Robotics Club
It's been a long time coming since we started out club over 5yrs ago.
So there's a lot of catching up to do on here.

This blog is used mainly for posting all the activities.
The main website has been moved recently and the pages are still being transferred.

=Dan