PDA

View Full Version : multipul outputs



MR SPARKY
09-16-2008, 04:37 PM
I have written many programs and every one i had send a high or low signal to multipul pins. my question is simple, can I tell two different pins to go low or high in one line. For example: I want pins 1,5,9, and 13 to go low. The way i have been doing it is with 4 lines of code. is there any way to consolidate it. I have attached an example of the way I am doing it now. If someone could tell if this is consolidatable. If so where can I find the information on how to do it. I have been looking for a while and have no clue what im looking for or where to find it.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I light up·everyones life!!!!!

NR1X
09-16-2008, 04:43 PM
check out the output registers and direction registers.. look in stamp manual under "outs" and "dirs"

MR SPARKY
09-16-2008, 05:53 PM
I see the bits. out then the number of the bit. but I am not sure how to seperate them in the line. I did not see anything in that secctio to show seperation. I not really understanding it to well. can some one please shed some light on the situation.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I light up·everyones life!!!!!

Bruce Bates
09-16-2008, 06:46 PM
Sparky -

You don't separate them, you use them in groups of 4, 8 or 16 pins as required. It's merely a matter of logically assigning consecutive physical pin ports when you do your wiring. Once you've done it, you'll never turn back.

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON

NR1X
09-17-2008, 02:15 AM
outs =% 1101110111011101 would make pins 1,5, 9 and 13 low all others would be high
outl =%11011001 would make pins 1,2,and 5 low all others high
outh does the same, but addresses pins 8 through 15
if you wanted to address 4 consecutive pins you would use :
outa for pins 0 through 3
outb for pins 4,5,6,7
outc = 8,9,10,11
outd = 12,13,14,15

MR SPARKY
09-17-2008, 09:19 AM
kb1nrb that was what I had figured but i cant get it to work. i am not sure if I am writng the code incorrectly or not. I tryed it but the leds did not light.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I light up·everyones life!!!!!

Mike Green
09-17-2008, 10:15 AM
Make sure you have the corresponding DIRS / DIRL / DIRH / DIRA / DIRB / DIRC / DIRD bits set to all one bits to make the I/O pins outputs.

In any event, we can't help you figure out what's wrong without a posted copy of your source program. If it's short, use the [ code ] [ /code ] brackets to include it in your message (without the extra spaces). If it's long, attach it to your message using the Attachment Manager.

MR SPARKY
09-17-2008, 11:29 AM
I figured it out. I did not put the dir bit set in. thanks for all the help. this will save some trees.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I light up·everyones life!!!!!