Serial Input and Analogue Outputs?

SSilver2k2

New Member
Hello all.

I have an 18X and I have two questions.

I want to be able to grab data from the PC through my download circuit and store that data in a variable. Is that possible?


Also, I have a low power motor attatched to an output. I want to be able to give this motor a controllable amount of power up to the limit of the chip. Is there a way to do this programatically through the software itself?
 

BeanieBots

Moderator
serin will read data from your PC and will store it in a variable.
NOT possible with the download circuit as is. Needs to be connected to a proper input but the resistor values are the same.
Program execution will stop until it gets the data.

I'm concerned about your motor connected directly to a PICAXE output.
What current (worst case ie stalled) will your motor draw when connected to 5v?
If the answer is more than 25mA, then don't do it. You risk damaging the PICAXE. Use a transistor or motor driver chip controlled by the PICAXE.
 
Last edited:

hippy

Technical Support
Staff member
The easiest way to receive serial from the PC using the download cable is to modify your circuit as shown below. Change the normal 10K pull-down to 22K, add a 22K to the Input Pin you want to use with SERIN and add a 2-pin Molex Header between Serial In and 0V. Remove the link when you want to download a program, insert the link when you want the program to run.

Code:
                                            .---------------.
TX to PC   <--------------------------------| SERIAL OUT    |
                            ___             |               |
                       .---|___|----------->| Ix            |
                       |    ___             |               |
RX From PC >-------.---^---|___|----.------>| SERIAL IN     |
                  .|.     2 x 22K   |       `---------------'
                  | |               O -.         PICAXE
0V         >--.   |_| 22K           O -' Link
             _|_  _|_              _|_
This does not comply with good engineering practice ( no resistor between the Molex link and 0V ) but should be suitable for most hobby and home uses.
 

SSilver2k2

New Member
serin will read data from your PC and will store it in a variable.
NOT possible with the download circuit as is. Needs to be connected to a proper input but the resistor values are the same.
Program execution will stop until it gets the data.

I'm concerned about your motor connected directly to a PICAXE output.
What current (worst case ie stalled) will your motor draw when connected to 5v?
If the answer is more than 25mA, then don't do it. You risk damaging the PICAXE. Use a transistor or motor driver chip controlled by the PICAXE.

well, the motor isnt really a motor. its just an led that turns on ti simulate a motor would be turning on. im not hooking up a motor to that pin.

now, does an 8m also have serin?
 

inglewoodpete

Senior Member
Have a close read of the SerIn command in the Command Manual pp138-140. This covers the pins and other hardware requirements for all on the PICAXE chips.
 

moxhamj

New Member
well, the motor isnt really a motor. its just an led that turns on ti simulate a motor would be turning on. im not hooking up a motor to that pin.

now, does an 8m also have serin?
Pick a pin. Any pin. Aren't picaxes versatile? :) Will your PC be talking to the picaxe with VB, VB.net, hyperterminal, C or some other software?
 
Top