nicholastyc
May 12 2008, 11:28 PM
Hi, Ajay, if u r there...or anyone else...
i am using pic12f629 ... which has 5 I/O and 1 always input GP 3,
i was trying to simulate the I/O setting in MPLAB IDE v7.3
this the code below...
BSF STATUS,5 ; go to bank 1
MOVLW b'00111000'; setting 3,4,5 input, 0,1,2 output
MOVWF TRISIO;
BCF STATUS,5; go back to bank 0
MOVLW 00h ; clear GPIO
MOVWF GPIO;
my problem is, wat i saw from the simulation mode, monitor on the TRISIO , i found that my TRISIO is always 0x08 instead of 0x38 (supposed like this 0x38) !!! i tried many combination again, its only changing the last four bit. why i cant change the bit 4 and bit 5 to input? please HELP....................................very frustated....
i am using pic12f629 ... which has 5 I/O and 1 always input GP 3,
i was trying to simulate the I/O setting in MPLAB IDE v7.3
this the code below...
BSF STATUS,5 ; go to bank 1
MOVLW b'00111000'; setting 3,4,5 input, 0,1,2 output
MOVWF TRISIO;
BCF STATUS,5; go back to bank 0
MOVLW 00h ; clear GPIO
MOVWF GPIO;
my problem is, wat i saw from the simulation mode, monitor on the TRISIO , i found that my TRISIO is always 0x08 instead of 0x38 (supposed like this 0x38) !!! i tried many combination again, its only changing the last four bit. why i cant change the bit 4 and bit 5 to input? please HELP....................................very frustated....
Ajay
May 13 2008, 3:34 PM
when you write 1 to GPIO bits then that GPIO becomes input port, so whatever is there on the input will be read while reading GPIO register.
In your case (in simulator) inputs are open and not connected to anything so ports (3,4,5) must read 0. Where as GPIO bit 3 will always read 1 (read datasheet for more information). and when MCLREN = 1 then GPIO bit 3 will always read 0.
Please read datasheet carefully.
In your case (in simulator) inputs are open and not connected to anything so ports (3,4,5) must read 0. Where as GPIO bit 3 will always read 1 (read datasheet for more information). and when MCLREN = 1 then GPIO bit 3 will always read 0.
Please read datasheet carefully.
nicholastyc
May 13 2008, 5:06 PM
so in this case , my port setting is correct?
i wan my GPIO3,4,5 as inputs and GPIO 0,1,2 as outputs. i read on the datasheet before i post. because i don understand on the MPLAB SIM, cos it never shows on the TRISIO that my GPIO 4,5 are the inputs. now u clear my mind.
thanks for your information.
i wan my GPIO3,4,5 as inputs and GPIO 0,1,2 as outputs. i read on the datasheet before i post. because i don understand on the MPLAB SIM, cos it never shows on the TRISIO that my GPIO 4,5 are the inputs. now u clear my mind.
thanks for your information.
Ajay
May 14 2008, 2:27 PM
check the file registers, it will atleast show the value you are storing in TRISIO.
nicholastyc
May 14 2008, 6:49 PM
HI AJAY,
the trisio never show my GPIO 4 and 5 as input.
i just cant understand why..
my code
ORG 0x00
BCF STATUS,RP0;
MOVLW 00h ;
MOVWF GPIO;
BSF STATUS,RP0 ;
MOVLW 38h;
MOVWF TRISIO;
BCF STATUS,RP0;
then will go to main...
thanks..please correct my code if there is any problem..
the trisio never show my GPIO 4 and 5 as input.
i just cant understand why..
my code
ORG 0x00
BCF STATUS,RP0;
MOVLW 00h ;
MOVWF GPIO;
BSF STATUS,RP0 ;
MOVLW 38h;
MOVWF TRISIO;
BCF STATUS,RP0;
then will go to main...
thanks..please correct my code if there is any problem..