Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

config 0x211c pic 16f628

Status
Not open for further replies.

kiranswaps

New Member
i am going through the tutorials on nigel site .i am trying to glow led s on a port Ausing pic16f628. but ra5 pin is not glowing .i have made the setting like this.

LIST p=16F628 ;tell assembler what chip we are using
include "P16F628.inc" ;include the defaults for the chip
;__config 0x3D18 ;sets the configuration settings
__config 0x211C ;(oscillator type etc.)

org 0x0000 ;org sets the origin, 0x0000 for the 16F628,
;this is where the program starts running
movlw 0x07
movwf CMCON ;turn comparators off (make it like a 16F84)

bsf STATUS, RP0 ;select bank 1
movlw b'00000000' ;set PortB all outputs
movwf TRISB
movwf TRISA ;set PortA all outputs
bcf STATUS, RP0 ;select bank 0

Loop
movlw 0xff
movwf PORTA ;set all bits on
movwf PORTB
nop ;the nop's make up the time taken by the goto
nop ;giving a square wave output
movlw 0x00
movwf PORTA
movwf PORTB ;set all bits off
goto Loop ;go back and do it again

end




what maight be the problem. how to connect the ra5 pin and led. i tried both source and sink type.
but no change
please help me.
thanks
 
Quote from data sheet:

"PORTA is an 8-bit wide latch. RA4 is a Schmitt Trigger input and an open drain output. Port RA4 is multiplexed with the T0CKI clock input. RA5 is a Schmitt Trigger input only and has no output drivers."

So, you can't use A5 as an output.

Mike.
 
but the program on that site is for glowing leds on port a and portb pins.
that means it is wrong

can nigel please help me with this
 
kiranswaps said:
but the program on that site is for glowing leds on port a and portb pins.
that means it is wrong

can nigel please help me with this
Why would it be wrong?
I think he is not using RA5 either. There is no practical why how to force RA5 as output (except internal Pull-up trick).
 
Nigel's tutorial board:
This is the Switch Board, a simple array of four pushbutton switches connected to the top four pins of one port, with four LED's connected to the bottom four pins of the same port (so you don't require the LED board as well). The switches connect to the top four pins of PortA, this is because RA5 can only be an input, and RA4 is an open-collector output - by using the top four pins it leaves the others available as general purpose I/O pins. Although it's labelled as connecting to PortA, it can also be connected to PortB if required.
 
kiranswaps said:
but the program on that site is for glowing leds on port a and portb pins.
that means it is wrong

can nigel please help me with this

Hi,

It's not supposed to be a practical project for flashing LED's on all the pins, it's just a demonstration of how to flash LED's - simply toggling the entire port is a very simple demonstration of that.

As such, it also demonstrates the differences between the two ports, as you've found, not all pins are created equal :lol:
 
Status
Not open for further replies.

Latest threads

Back
Top