|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||||
|
|||||
|
Odd Problem With Old EDU Bot
Hey,
I'm having a really strange problem with the old EDU controller (I think two years ago -- the first one to use a PIC processor and it needed an external RC controller). I've pulled it out to use on an un-related project, but the digital inputs don't seem to be working. I've initialized them properly: IO1 = IO2 ... IO8 = INPUT; I've turned off analog: Set_Number_Of_Analog_Channels(NO_ANALOG); I've set the rest of the pins to output: IO9 = IO10 ... IO16 = OUTPUT; rc_dig_out09 ... rc_dig_out16 = 0; Then when I check the values of the pins: printf("rc_dig_in01: %d ... rc_dig_in08: %d\n", rc_dig_in01 ... rc_dig_in08); I get: 257 257 257 257 0 0 0 0 Things get stranger. If I ground input 1, the output becomes: 1 257 257 257 0 0 0 0 And grounding other pins change random values (pin 4 changes value 2 from 257 to 256, etc). EDIT: I've figured out the pattern: Grounding input 1 will cause the value of input 1 to be 1 Grounding input 2 will cause the value of input 1 to be 256 Grounding input 3 will cause the value of input 2 to be 1 Grounding input 4 will cause the value of input 2 to be 256 And so on... If 16 is set as an input, it will cause the value of 8 to change from 1 to 0 Every input after 8 (9 and up) are 0 and I can't get 'em to change. It dosen't seem to make any difference if I define none of the inputs as analog or all the inputs as analog (NO_ANALOG or EIGHT_ANALOG). I'm using the default code from http://www.ifirobotics.com/edu-rc.shtml with the most recent firmware. I have tried simple modifications to the default code (just printf("%d\n",rc_dig_in06); (where in06 defaults to an input) and similarly strange results have occurred. Any advice would be greatly appreciated! Thanks, David Last edited by wun : 06-03-2006 at 01:09. |
|
#2
|
|||||
|
|||||
|
Re: Odd Problem With Old EDU Bot
The %d format specifier wants to see an integer. The rc_dig_in## values are being passed to printf as chars. What you're seeing is the eight char values being printed as four int values.
To fix it, cast the switch values as ints. Code:
rintf("rc_dig_in01: %d ... rc_dig_in08: %d\n", (int)rc_dig_in01 ... (int)rc_dig_in08);
|
|
#3
|
|||||
|
|||||
|
Re: Odd Problem With Old EDU Bot
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Labview CMUcam demo problem | Windward | LabView and Data Acquisition | 19 | 11-08-2007 02:33 |
| The best thing you can do when reporting a problem .. | Brandon Martus | CD Forum Support | 1 | 08-02-2006 07:46 |
| Need a realistic Statics Problem | sanddrag | Technical Discussion | 10 | 05-12-2005 15:07 |
| Getting A Bot To Turn | Andrew Blair | Technical Discussion | 20 | 16-10-2005 23:49 |
| serious problem found - robot controller resets when jarred! | KenWittlief | Electrical | 23 | 19-03-2003 13:30 |