Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

68HC11 Based Robot Help

Status
Not open for further replies.
I've built a small tank-tread robot with a 68HC11E2 chip, and am having some problems reading sensors. My motor outputs work fine, but the 'bot will only read one sensor, on the LSB line. I know both sensors work, because I can switch and it reads the other sensor on the LSB. When the 68HC11 boots in single-chip mode (like it's set to do right now), Port C (which I'm trying to use) defaults to all inputs. I'm just not sure why I can't read anything other than the LSB. My code is reading the entire byte, not just a bit. I'm using sbasic to write the code, which right now is set to trigger the left motor for the left sensor and the right motor for the right sensor. Any ideas/experiences?

-Infamous
 
I used 68HC11E9 to do my project last time, but in assembly language. Port C can be either input or output, you have to configure that port. How do you write the code for getting input from port C? Is the input pin floating?
 
The other (unused) inputs might be floating, I'll try modifying the DDRC to only accept on two bits...

The sensors have pull downs on them, so I know that's not the problem. I don't think the pins are really floating either, because the LSB always works, and the code isn't using binary; it's using plain 'ol integers.
 
how do you check the input?
for example, load port c to accumulator a, then it is ANDed with $01 (which is 00000001 in binary, so checking the LSB), then BEQ (Branch back if EQual to zero), otherwise, continue the following code.

Is it like that you check the input?
 
I'm writing in SBASIC (Google it, first hit is the download). It uses peek and poke, just like any other basic variant. I'm peeking at $1003 and pulling a byte from the port. I know there's a 16-bit peek as well; I'll try that today and see if it helps.

(There's just not enough time to learn assembly before the competition...:D )
 
Update...

Got it fixed. Didn't realize the sensors I built were active off...found that out pretty quickly (not...). I built the sensor boards without looking at the fact that it had a pull-up and not a pull-down.

Thanks for the help though!
 
The robot's finished...I've been up about 23 1/2 hours straight. School, then robot building, then work 'til midnight, then building until now. It works though. It's designed to move through a "journey course," with a hill in the middle. The link's here:

www.nationalroboticschallenge.org

Here's the Journey course:

**broken link removed**

I have to be there inside of 5 hours...oh joy!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top