Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 05, 2024, 10:50:39 10:50


Login with username, password and session length


Pages: [1]
Print
Author Topic: Help! Needed? in Mikroc, why is this not working?  (Read 4630 times)
0 Members and 1 Guest are viewing this topic.
jaikumar
Junior Member
**
Offline Offline

Posts: 45

Thank You
-Given: 47
-Receive: 18


« on: August 31, 2007, 08:12:44 08:12 »

Hwlp In mikroc why is this not working PORTC.F0 = ~PORTC.F0 or PORTC.F0 = !PORTC.F0 with tris set up.
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #1 on: August 31, 2007, 08:31:56 08:31 »

Hwlp In mikroc why is this not working PORTC.F0 = ~PORTC.F0 or PORTC.F0 = !PORTC.F0 with tris set up.

All above are working for me but with PORTB:
 PORTB.F0 = ~PORTB.F0;
 PORTB.F0 = !PORTB.F0;

Has your PIC PORT C? (in my case the PIC16F628A has only A and B ports)

zuisti
Logged
jaikumar
Junior Member
**
Offline Offline

Posts: 45

Thank You
-Given: 47
-Receive: 18


« Reply #2 on: August 31, 2007, 10:16:25 10:16 »

Thanks Zuisti,
I am using 16F684 and this does not work. will try again.
Logged
zuisti
Senior Member
****
Offline Offline

Posts: 409

Thank You
-Given: 242
-Receive: 780


« Reply #3 on: August 31, 2007, 12:40:37 12:40 »

Thanks Zuisti,
I am using 16F684 and this does not work. will try again.

Hi Jaikumar,
Please read carefully the data sheet:
http://ww1.microchip.com/downloads/en/devicedoc/41202C.pdf

An extract from this:

4.3 PORTC

Note: The ANSEL (91h) and CMCON0 (19h)
registers must be initialized to configure
an analog channel as a digital input
. Pins
configured as analog inputs will read ‘0’.

EXAMPLE 4-3: INITIALIZING PORTC

BCF STATUS,RP0 ;Bank 0
CLRF PORTC ;Init PORTC
MOVLW 07h ;Set RC<4,1:0> to
MOVWF CMCON0 ;digital I/O
BSF STATUS,RP0 ;Bank 1
CLRF ANSEL ;digital I/O
MOVLW 0Ch ;Set RC<3:2> as inputs
MOVWF TRISC ;and set RC<5:4,1:0> as outputs
BCF STATUS,RP0 ;Bank 0

Hope this helps!
zuisti
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC