kannan.k
Junior Member level 2
- Joined
- Jan 17, 2006
- Messages
- 24
- Helped
- 1
- Reputation
- 2
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- chennai, India
- Activity points
- 1,541
16f88 porta digital outputs
Hi people.
I am working with the 8051 controller now and have started to learn the pic microcontroller. I Have a few issues and questions. The very first thing i am trying to do is to toggle a LED.
I am using
device 16F88
IDE MPLAB 7.10
OS win98
SW ICrprog 105D
HW multipicprogrammer from **broken link removed**
guidance **broken link removed**
My code
My first question is that the porta does not give the proprer output (in the simulator) when
the movwf porta instruction is executed. any value upto 0x0f gives 00 and values greater that 10h shows up only as 10h in the port.... am i setting the trisa/b registers correctly?
My second question. The portb shows the correct value during simulation but when programmed and in the board it is is not working. I checked with my multimeter..... all the connections are ok.... and also i am sure the programmer is working fine.... programming and verification procedure does not give any errors.
While loading ICprog warns that the hex file does not contain a configuration and device ID information...
please help me out
Thanks.
kannan.k
ok.... I again read the data sheet and found that the adc registers have to be modified for the port operation.....but still i am facing the issue with the hardware.
Hi people.
I am working with the 8051 controller now and have started to learn the pic microcontroller. I Have a few issues and questions. The very first thing i am trying to do is to toggle a LED.
I am using
device 16F88
IDE MPLAB 7.10
OS win98
SW ICrprog 105D
HW multipicprogrammer from **broken link removed**
guidance **broken link removed**
My code
Code:
;*****Set up the Constants****
;#include <p16f88.inc>
STATUS equ 03h ;Address of the STATUS register
TRISA equ 85h ;Address of the tristate register for port A
PORTA equ 05h ;Address of Port A
TRISB equ 86h ;Address of the tristate register for port B
PORTB equ 06h ;Address of Port B
COUNT1 equ 20h ;08 ;First counter address for our delay loops
COUNT2 equ 21h ;09 ;Second counter address for our delay loops
;****Set up the port****
bsf STATUS,5 ;Switch to Bank 1
movlw 00h ;Set the Port A pins
movwf TRISA ;to output.
movlw 00h ;Set the Port B pins
movwf TRISB ;to output.
bcf STATUS,5 ;Switch back to Bank 0
;****Turn the LED on****
Start movlw 0ffh ;Turn the LED on by first putting it
movwf PORTA ;into the w register and then on the port
movlw 0fh
movwf PORTB
;****Add a delay
;lot of delay calls are here
;****Delay finished, now turn the LED off****
movlw 00h ;Turn the LED off by first putting it
movwf PORTA ;into the w register and then on the port
movlw 00h
movwf PORTB
;****Add another delay****
;lot of delay calls are here
;****Now go back to the start of the program
goto Start ;go back to Start and turn LED on again
;****Here is our Subroutine
Delay
Loop1 decfsz COUNT1,1 ;This second loop keeps the LED
goto Loop1 ;turned off long enough for us to
decfsz COUNT2,1 ;see it turned off
goto Loop1 ;
return
;****End of the program****
end
My first question is that the porta does not give the proprer output (in the simulator) when
the movwf porta instruction is executed. any value upto 0x0f gives 00 and values greater that 10h shows up only as 10h in the port.... am i setting the trisa/b registers correctly?
My second question. The portb shows the correct value during simulation but when programmed and in the board it is is not working. I checked with my multimeter..... all the connections are ok.... and also i am sure the programmer is working fine.... programming and verification procedure does not give any errors.
While loading ICprog warns that the hex file does not contain a configuration and device ID information...
please help me out
Thanks.
kannan.k
ok.... I again read the data sheet and found that the adc registers have to be modified for the port operation.....but still i am facing the issue with the hardware.