
Originally Posted by
ronbowalker
I am trying to initialize a PIC16F819 and it will not take the PORTB pins to a LOW setting on initialization. It does PORTA just fine, and it does both TRISA and TRISB settings correctly. What is it I am missing here?
'CODE:
'Initialize Inputs/Outputs
TRISA = %01110100
TRISB = %01000000
'Initialized Highs/Lows
PORTA = %10000001
PORTB = %00000000
I have also tried to use the (PORTB.0 = 0) way, and it too does not work.
Neither does (LOW PORTB.0).
Never had this problem with any of the other chips I have used.
Here is the .INC file info for MPASM......
__CONFIG _INTRC_IO & _WDT_OFF & _PWRTE_OFF & _LVP_OFF & _MCLR_OFF & _BODEN_OFF & _DEBUG_OFF
Hello ronbowalker,
enable the port latches Before the tris registers. Disable the other functions on these port pins especially any analog functions like CCP. CCP1CON = 0 SSPCON.5 = 0 ' disables Syncro. serial port
"When enabling peripheral functions, care should be
taken in defining TRIS bits for each PORTB pin. Some
peripherals override the TRIS bit to make a pin an output,
while other peripherals override the TRIS bit to
make a pin an input. Since the TRIS bit override is in
effect while the peripheral is enabled, read-modifywrite
instructions (BSF, BCF, XORWF) with TRISB as
the destination should be avoided. The user should
refer to the corresponding peripheral section for the
correct TRIS bit settings."
Last edited by Archangel; - 8th December 2009 at 03:04.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks