3BABY
Member level 5

- Joined
- Jan 14, 2011
- Messages
- 91
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- New Zealand
- Activity points
- 2,252
Hi Guys,
so after working on my project for a few months now i have come across some strange output.. i have set up the ports below, basically after some computations im my program i output an 8bit binary number to portb.. portd is working fine.. the strange thing is.. when i turn on my development board say for example i am expecting 01001000 on portb (after computations and im inputing a static variable), i dont get this result i get 10011110.. this is not a problem with my math functions in my program ( i have checked them and verified in MPLAB SIM) sometimes when i turn on the development board i get the proper result, then ill turn it off and back on and i will have the incorrect output on portb.. it seems like an intermittent problem.. and the only thing i can think of is that i have not setup the ports properly? i have all the outputs pulled low via a 10k resistor on each. i have tryed using a differnt MCU (PIC18F4550).. and i have the same problem
any help would be much appreciated!
so after working on my project for a few months now i have come across some strange output.. i have set up the ports below, basically after some computations im my program i output an 8bit binary number to portb.. portd is working fine.. the strange thing is.. when i turn on my development board say for example i am expecting 01001000 on portb (after computations and im inputing a static variable), i dont get this result i get 10011110.. this is not a problem with my math functions in my program ( i have checked them and verified in MPLAB SIM) sometimes when i turn on the development board i get the proper result, then ill turn it off and back on and i will have the incorrect output on portb.. it seems like an intermittent problem.. and the only thing i can think of is that i have not setup the ports properly? i have all the outputs pulled low via a 10k resistor on each. i have tryed using a differnt MCU (PIC18F4550).. and i have the same problem
any help would be much appreciated!
Code:
;------------ Port Settings --------------------------------------
CLRF PORTB ;PORTB is output
CLRF TRISB
CLRF PORTD ;PORTD - output except RD6 which is input
BCF TRISD, RD0
BCF TRISD, RD1
BCF TRISD, RD2
BCF TRISD, RD3
BCF TRISD, RD4
BCF TRISD, RD5
BSF TRISD, RD6
BCF TRISD, RD7
;--- after computations--
MOVFF VAR2, PORTB