CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PORTb Int_ext0 & OUTPUT_B(x) doubt?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sf



Joined: 02 Jul 2007
Posts: 9

View user's profile Send private message

PORTb Int_ext0 & OUTPUT_B(x) doubt?
PostPosted: Wed Feb 11, 2009 6:24 pm     Reply with quote

Hi, I have the next:

On PortB B0 is used for an external interrupt(Pull-up installed).
B1 to B7 to a 7 segments display.

I have made the next "declarations":
#use fast_io(b)

and in main:
set_tris_b( 0b00000001 );
........

After this, B0 is always input or can change at compile time????
I make this question because this: (tested)
When I output a value to the display on B0 (without making an interrupt intentionally) is 0V, when i do not display any value to the display the 5V back to B0.

For output the value is used: output_B(digit_p[n]);
So, when we set this on code( #use fast_io() and set_tris_x() ) the direction can change without "notification", or change??????

ThankĀ“s on advance.

Note:
pic18f1320
display values : xxxxxxx0
ccs version 4.084
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 11, 2009 7:00 pm     Reply with quote

Make a test program. Look at the .LST file.
Code:
#include <18F1320.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000) 
     
#use fast_io(b)

//====================================
void main()
{
int8 digit_p[10];
int8 n;

set_tris_b( 0b00000001 );

output_B(digit_p[n]);

while(1);     
}


It only changes the TRIS in the set_tris_b() statement, as shown in
bold below. This was compiled with vs. 4.084.
Quote:

.................... void main()
.................... {
0004: CLRF TBLPTRU
0006: BCF RCON.IPEN
0008: CLRF FSR0H
000A: CLRF FSR0L
000C: BCF ADCON0.VCFG0
000E: BCF ADCON0.VCFG1
0010: MOVF ADCON1,W
0012: ANDLW 80
0014: IORLW 7F
0016: MOVWF ADCON1
.................... int8 digit_p[10];
.................... int8 n;
....................
.................... set_tris_b( 0b00000001 );
0018: MOVLW 01
001A: MOVWF TRISB
....................
....................
.................... output_B(digit_p[n]);
001C: CLRF @03
001E: MOVF n,W
0020: ADDLW digit_p
0022: MOVWF FSR0L
0024: MOVLW digit_p+-6
0026: ADDWFC @03,W
0028: MOVWF FSR0H
002A: MOVFF INDF0,@@11
002E: MOVFF @@11,LATB
....................
.................... while(1);
0032: BRA 0032
.................... }
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group