Okay, deadlines are this saturday. I got the chips communicating with a wired connection. On a 16F684 I used the pin portc.1 to communicate. I got it to send a variable (but now I just changed it to two word sized variables (movement1 for forward and reverse motors, and movement2 for turns). When I did one veriable, it worked perfectly by using this:
Code:
TRAIN VAR BYTE
movement1 var word
movement2 var word
PORTc.1 = 1 'turn enable pin high
TRAIN=$55
SEROUT PORTc.1,T2400,[TRAIN,TRAIN,TRAIN,TRAIN,TRAIN,9,movement1,movement2]
goto get_actions
goto start
and this to receive:
*movement1 and 2 have been declared in the beginning of code
Code:
TRAIN VAR BYTE
Start:
PORTc.1 = 1 'turn communication pin high
TRAIN=$55
SERIN PORTC.1,T2400,[9],movement1,movement2
gosub get_actions
goto start
forward:
forwardleft:
forwardright:
backward:
backwardleft:
backwardright:
turnleft:
turnright:
nomov:
the last labels are where my actions to route power to the motors will go...that will be the simpler part I suppose.
Also, I want to add buttons to my remote control. It will simple momentary tact buttons but I still do not understand what will need to be hooked up to make this stuff work. Basically, I will need around 6 buttons or so...maybe all in the porta pins. That will be the basic way to do it...given each direction a button (e.g. L, R, FL, FR, Rl, RR). But now I am thinking of using the two movement word variables (movement1 & movement2) to do two things at once. So, when I press R and the forward button (almost like a dpad), it will send out those two variables to the chip in the car. But Idk how to make those two variables run at the same time
. Like...if I am doing left and forward, then I want left and forward to be enabled at the same time.
*actually...wouldn't tris and port commands do this quicky?

It's late and I am tired...
anyways, here is what I have for the buttons as described above...will this section of code work work with momemtary tact switches like I said? Or do I have to use the button command? If I am missing or doing something wrong in any part of this...please, please help me out. Also, if you have any tuts or previous codes your wrote and don't mind PMing me...then please do.
Code:
get_actions:
if leftbutton = 0 then
turns = 1 ;turns = 1 means a left turn
else
turns = 0 ;no turn at all
endif
if rightbutton = 0 then
turns = 2 ;turn = 2 means a right turn
else
turns = 0 ;no turn at all
endif
if backwards = 0 then
forwardsandback = 1
else
forwardsandback = 0
endif
if forward = 0 then
forwardsandback = 2
else
forwardsandback = 0
endif
goto start ;now we have all the buttons pressed at this small
;interval of time...we need to send it.
*the serout command is located after start
I have been working on this for a long time and have spent so much money that I decided to buy those rentron transmitter and receiver pair. I did next day shipping on it too as I need them fast.
If I were to use tho...will I have to encode anything or can I just connect the transmitter to the remote control pin and the receiver to the car?
Oh, I bought these:
1 - RXLC-315-LR High-Performance RF Receiver Module
http://www.rentron.com/remote_control/RXLC-434LR.htm
1 - TXLC-315-LR High-Performance RF Transmitter Module
http://www.rentron.com/remote_control/TXLC-XXX-LR.htm
I got the full code compiling but just a few things I am not sure about stilll...I have the chassis and also ordered some motors from...well...for now I forgot the place. But it was like 10 DC motors and stuff...
ONE MAJOR QUESTION!!!!
How do I make my car stop? I mean, using a DC motor...if u take the currect away from it, the car will still keep on rolling...how can I make it so that it locks up and stops? Is it possible by reading the adc or something and making it go postive, then negative then positive (pulse???) make it stop?
Please give me something to work on that above guys.
Regards,
n0rig
P.S. Pin diagram attached is not final...just something that I keep on erasing and stuff...then changing it again.
P.S.S. Help me because this is my first time using PicBasic
Bookmarks