EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

how do you make port a and B in or output in CCS ?

Started by Vincent August 30, 2005
Message
Hi all,
 
working on a PIC16F628, I try to configure its I/O with pull-ups on B port and set Input or output direction on port A and B...
 
output_float(pin_A1);
output_float(pin_A2);
output_float(pin_A3);
output_float(pin_A5);
output_float(pin_A6);
output_float(pin_A7);
output_float(pin_B0);
output_float(pin_B6);
output_float(pin_B7);
 
gives nothing...
 
No mre than :
#use fixed_io(a_outputs=PIN_A4)
#use fixed_io(b_outputs=PIN_B1,PIN_B2,PIN_B3,PIN_B4,PIN_B5)
 
 
#USE STANDARD_IO(B)
#USE STANDARD_IO(A)
with
 SET_TRIS_A( 0x10 ); // PORTA  RA7-RA0 = Out Out Out In Out Out Out Out
 SET_TRIS_B( 0xC1 ); // PORTB  RB7-RB0 = In In Out Out Out Out Out In
 
Can anyone help to clearly define what needs to be done ????
 
By the way, any pointers to good documentation or tuts for CCS would be great !!
The Help files is rather poor even if many exemples do well !!
 
Thank a lot !
 
Vince


Thank for this but that's not exactly what I need !

I have no problem with the '628. I do anything I need in asm.
My problem is not with the internal register and the way to use them...
My problem is more related to CCS it self...

How do you configure Inputs/Outputs ports in CCS ???

Actually, I am trying to translate my asm code in C... But it's a fail for
the moment because of IO malfuntions !!!

If anyone has a snipet of code as a starting exemple, that would be
sufficient !!

Thanks for any helping hand !!

Vincent

-----Original Message-----
From: piclist@picl... [mailto:piclist@picl...] On Behalf Of
rtstofer
Sent: mercredi 31 ao 2005 06:10
To: piclist@picl...
Subject: [piclist] Re: how do you make port a and B in or output in CCS ? --- In piclist@picl..., "Vincent" <vincent.clerc@i...> wrote:
> Hi all,
>
> working on a PIC16F628, I try to configure its I/O with pull-ups
on B port
> and set Input or output direction on port A and B...
>
> output_float(pin_A1);
> output_float(pin_A2);
> output_float(pin_A3);
> output_float(pin_A5);
> output_float(pin_A6);
> output_float(pin_A7);
> output_float(pin_B0);
> output_float(pin_B6);
> output_float(pin_B7);
>
> gives nothing...
>
> No mre than :
> #use fixed_io(a_outputs=PIN_A4)
> #use fixed_io(b_outputs=PIN_B1,PIN_B2,PIN_B3,PIN_B4,PIN_B5) > #USE STANDARD_IO(B)
> #USE STANDARD_IO(A)
> with
> SET_TRIS_A( 0x10 ); // PORTA RA7-RA0 = Out Out Out In Out Out
Out Out
> SET_TRIS_B( 0xC1 ); // PORTB RB7-RB0 = In In Out Out Out Out Out
In
>
> Can anyone help to clearly define what needs to be done ????
>
> By the way, any pointers to good documentation or tuts for CCS
would be
> great !!
> The Help files is rather poor even if many exemples do well !!
>
> Thank a lot !
>
> Vince

One of the things that will bite you with the '628 is CMCON. By
default, PORTA is analog.

You should get the datasheet for the device and the Mid-Range MPU
manual.
to unsubscribe, go to http://www.yahoogroups.com and follow the instructions

Yahoo! Groups Links



--- In piclist@picl..., "Vincent" <vincent.clerc@i...> wrote:
> Hi all,
>
> working on a PIC16F628, I try to configure its I/O with pull-ups
on B port
> and set Input or output direction on port A and B...
>
> output_float(pin_A1);
> output_float(pin_A2);
> output_float(pin_A3);
> output_float(pin_A5);
> output_float(pin_A6);
> output_float(pin_A7);
> output_float(pin_B0);
> output_float(pin_B6);
> output_float(pin_B7);
>
> gives nothing...
>
> No mre than :
> #use fixed_io(a_outputs=PIN_A4)
> #use fixed_io(b_outputs=PIN_B1,PIN_B2,PIN_B3,PIN_B4,PIN_B5) > #USE STANDARD_IO(B)
> #USE STANDARD_IO(A)
> with
> SET_TRIS_A( 0x10 ); // PORTA RA7-RA0 = Out Out Out In Out Out
Out Out
> SET_TRIS_B( 0xC1 ); // PORTB RB7-RB0 = In In Out Out Out Out Out
In
>
> Can anyone help to clearly define what needs to be done ????
>
> By the way, any pointers to good documentation or tuts for CCS
would be
> great !!
> The Help files is rather poor even if many exemples do well !!
>
> Thank a lot !
>
> Vince

One of the things that will bite you with the '628 is CMCON. By
default, PORTA is analog.

You should get the datasheet for the device and the Mid-Range MPU
manual.



Message

 Hi all,
 
I finally found the problem.
 
It was a bad intercation with the FUSES that causes my PIC to be unstable.
Pin MCLR is used in my design, and the fuse was not set to reflect that...
 
My pic was maintain in reset state, giving the apparent bad pin state programmation !
 
Thanks a lot to those how answered !
Vince
 
 -----Original Message-----
From: p...@yahoogroups.com [mailto:p...@yahoogroups.com] On Behalf Of Vincent
Sent: mardi 30 ao 2005 19:33
To: p...@yahoogroups.com
Subject: [piclist] how do you make port a and B in or output in CCS ?

Hi all,
 
working on a PIC16F628, I try to configure its I/O with pull-ups on B port and set Input or output direction on port A and B...
 
output_float(pin_A1);
output_float(pin_A2);
output_float(pin_A3);
output_float(pin_A5);
output_float(pin_A6);
output_float(pin_A7);
output_float(pin_B0);
output_float(pin_B6);
output_float(pin_B7);
 
gives nothing...
 
No mre than :
#use fixed_io(a_outputs=PIN_A4)
#use fixed_io(b_outputs=PIN_B1,PIN_B2,PIN_B3,PIN_B4,PIN_B5)
 
 
#USE STANDARD_IO(B)
#USE STANDARD_IO(A)
with
 SET_TRIS_A( 0x10 ); // PORTA  RA7-RA0 = Out Out Out In Out Out Out Out
 SET_TRIS_B( 0xC1 ); // PORTB  RB7-RB0 = In In Out Out Out Out Out In
 
Can anyone help to clearly define what needs to be done ????
 
By the way, any pointers to good documentation or tuts for CCS would be great !!
The Help files is rather poor even if many exemples do well !!
 
Thank a lot !
 
Vince


Hi,

Yeah, I've ran into that!

Miss-set comparitor settings can also kill digital inputs on shared pins.

And just wondering, I have the mid-range manual, but I don't recall seeing a
high-range MPU manual. (18F4620 or there abouts). I have several data sheets
for the 18F's I'm interested in.

Alan KM6VV rtstofer wrote:

> --- In piclist@picl..., "Vincent" <vincent.clerc@i...> wrote:
>
>>Hi all,
>>
>>working on a PIC16F628, I try to configure its I/O with pull-ups
>
> on B port
>
> <SNIP>
>>
>>Vince > One of the things that will bite you with the '628 is CMCON. By
> default, PORTA is analog.
>
> You should get the datasheet for the device and the Mid-Range MPU
> manual. >


Hi Vincent,

see SET_TRIS_B() in the manual (available as a PDF). Also disable A/D or any
other peripheral that shares the pins.

CCS is an interesting compiler, but you might consider the Hi-Tech or PICC
compilers too (some free demos).

I prefer to code the setup or initialization my self.

TRISA = 0B11111111; /* EMFD, EMF3, FLOW, EMFR, NA, QUES, TRGR, TRGD, TRG3 in */

TRISB = 0B00110011; /* IRI, KEY, IROD, FLSH, HALL, HALLT, D2, D3 */

ADCON0 = 0; /* A/D off */
ADCON1 = 6; /* all digital inputs */

CVRCON = 0; /* turn off compare modules */
CMCON = 7; /* 7 is power on reset, 0 kills PORTA */ Alan KM6VV Vincent wrote:

> Thank for this but that's not exactly what I need !
>
> I have no problem with the '628. I do anything I need in asm.
> My problem is not with the internal register and the way to use them...
> My problem is more related to CCS it self...
>
> How do you configure Inputs/Outputs ports in CCS ???
>
> Actually, I am trying to translate my asm code in C... But it's a fail for
> the moment because of IO malfuntions !!!
>
> If anyone has a snipet of code as a starting exemple, that would be
> sufficient !!
>
> Thanks for any helping hand !!
>
> Vincent >
>
> -----Original Message-----
> From: piclist@picl... [mailto:piclist@picl...] On Behalf Of
> rtstofer
> Sent: mercredi 31 ao 2005 06:10
> To: piclist@picl...
> Subject: [piclist] Re: how do you make port a and B in or output in CCS ? > --- In piclist@picl..., "Vincent" <vincent.clerc@i...> wrote:
>
>>Hi all,
>>
>>working on a PIC16F628, I try to configure its I/O with pull-ups
>
> on B port
>
>>and set Input or output direction on port A and B...
>>
>>output_float(pin_A1);
>>output_float(pin_A2);
>>output_float(pin_A3);
>>output_float(pin_A5);
>>output_float(pin_A6);
>>output_float(pin_A7);
>>output_float(pin_B0);
>>output_float(pin_B6);
>>output_float(pin_B7);
>>
>>gives nothing...
>>
>>No mre than :
>>#use fixed_io(a_outputs=PIN_A4)
>>#use fixed_io(b_outputs=PIN_B1,PIN_B2,PIN_B3,PIN_B4,PIN_B5)
>>
>>
>>#USE STANDARD_IO(B)
>>#USE STANDARD_IO(A)
>>with
>> SET_TRIS_A( 0x10 ); // PORTA RA7-RA0 = Out Out Out In Out Out
>
> Out Out
>
>> SET_TRIS_B( 0xC1 ); // PORTB RB7-RB0 = In In Out Out Out Out Out
>
> In
>
>>
>>Can anyone help to clearly define what needs to be done ????
>>
>>By the way, any pointers to good documentation or tuts for CCS
>
> would be
>
>>great !!
>>The Help files is rather poor even if many exemples do well !!
>>
>>Thank a lot !
>>
>>Vince > One of the things that will bite you with the '628 is CMCON. By
> default, PORTA is analog.
>
> You should get the datasheet for the device and the Mid-Range MPU
> manual. >
> to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
>
> Yahoo! Groups Links >
> to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
> Yahoo! Groups Links >
>



The 2024 Embedded Online Conference