Clewer,Brian wrote:
{Quote hidden}>
> Hi folks;
> I am new to pics so please forgive me!!
> Can anyone tell me why my first program does not work?
> The processor is a 16c84.
>
> pc equ 0h
> fsr equ 2h
> porta equ 5h
> portb equ 6h
> trisa equ 85h
> trisb equ 86h
> status equ 3h
> rp0 equ 5h
>
> org 0
>
> main:
> call init_portb ; Initialisation of port
> call led_output ; Output to leds
> goto main
>
> init_portb:
> clrf portb ;Initialise port by setting output latches
> bsf status, rp0 ;select bank one
> movlw 0x00 ;value used to init port
> movwf trisb ;set port b to all outputs
> bcf status, rp0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
||||||||||||||||||||||||||||||||||||||||||||||||||||
{Quote hidden}> return
>
> led_output:
> movlw 0xAA
> movwf portb
> return
>
> That's it !
>
> All I want it to do is to switch on some led's but when it tries to output
> to the port, it seems to alter the trisb!!
>
> Please help
You didn't return to PAGE 0 after setting up the direction.
Look in the init_portb: routine
--
Friendly Regards
Tjaart van der Walt
______________________________________________________________
| Another sun-deprived R&D Engineer slaving away in a dungeon |
|WASP International GSM vehicle tracking and datacomm solutions|
| +27-(0)11-622-8686 | http://wasp.co.za |
|______________________________________________________________|