Searching \ for 'problem with PicBasic Pro and portb' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/ios.htm?key=port
Search entire site for: 'problem with PicBasic Pro and portb'.

Truncated match.
PICList Thread
'problem with PicBasic Pro and portb'
1998\08\28@055626 by Rob Lawes

flavicon
picon face
Help!
Why does this not work. Any ideas?
Maybe the port is not set right. The value on the pins is not always
read at the right value.
The circuit has two complimentary bcd switches 0-9
with pullups. So 0=0000 9=1001 etc.
one bcd is connected to RB0-3 the other RB4-7
therefore 99 will Equal 10011001= 153

Switch 1
RB0 - bcd 1
RB1 - bcd 2
RB2 - bcd 4
RB3 - bcd 8

Switch 2
RB4 - bcd 1
RB5 - bcd 2
RB6 - bcd 4
RB7 - bcd 8



The value of the port does not have to equate to the value on the switch
face as long as they are all different.
The value of portb is then displayed on an led. the led flashes the
value out.

               I0      var     BYTE    'variable for portb pin state
               B0      var     BYTE    'variable for next loop

loop:           gosub idnumber
               pause 3000
               goto loop


haloon:         high porta.3            'turn halo leds on.
               return                  'return from sub.

halooff:        low porta.3             'turn halo leds off.
               return                  'return from sub.


idnumber:       peek portb,I0           'get id number of unit.
               if B0 = 0 then          'catch value 0 to stop one
                       goto out        ,cycle of the for next loop.
                       endif

               For B0 = 1 to I0        'loop for value of portb.
               gosub haloon            'call sub for led on.
               pause 300               'wait .3sec.
               gosub halooff           'call sub for led off.
               pause 300               'wait .3sec.
               Next B0                 'loop till value of portb.
out:            return



Thanks in Advance
--
Rob Lawes

1998\08\28@194031 by Regulus Berdin

flavicon
face
I am not very familiar PicBasic Pro, but is portb tri-stated on your
program? There seems no tri-state function called.

Also dip switches are switched to low, cosidering you have a pull-up,
so a 9 would be 0110 not a 1001.

Regards,
Reggie

Rob Lawes wrote:
{Quote hidden}

1998\08\29@084800 by cousens

flavicon
face
Rob Lawes wrote:
snip


               I0      var     BYTE    'variable for portb pin state
               B0      var     BYTE    'variable for next loop

loop:           gosub idnumber
               pause 3000
               goto loop

haloon:         high porta.3            'turn halo leds on.
               return                  'return from sub.

halooff:        low porta.3             'turn halo leds off.
               return                  'return from sub.



                       'add tris

idnumber:       trisb = 0
               peek portb,I0           'get id number of unit.

               'if B0 = 0 then          'catch value 0 to stop one

                       'don't you mean

               if IO = 0 then
                      goto out        ,cycle of the for next loop.
                       endif

               For B0 = 1 to I0        'loop for value of portb.
               gosub haloon            'call sub for led on.
               pause 300               'wait .3sec.
               gosub halooff           'call sub for led off.
               pause 300               'wait .3sec.
               Next B0                 'loop till value of portb.
out:            return

Thanks in Advance
> --
> Rob Lawes

--
Peter Cousens
email: spam_OUTcousensTakeThisOuTspamher.forthnet.gr  phone: + 3081 380534
snailmail:  Folia, Agia Fotini, Karteros, Heraklion  Crete, Greece.

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...