Searching \ for '[PIC]:help using CCS C code' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=c
Search entire site for: 'help using CCS C code'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:help using CCS C code'
2001\11\06@034857 by MATTHEWS, DEAN (D.)

picon face
To all,

I am trying to build the code below using a CCS C compiler without any joy. Originally I printed out the A2D conversion using the printf and rs232 function.  Now I want to display the hex number in 'value' using 10 leds - 10bit a2d result.

#device PIC16F877*16 ADC=10
#include<16F877.h>
#use delay(clock=20000000)
#use fast_IO(port_b)

void main (void)
{
  long value;

  setup_adc_ports(RA0_ANALOG_RA3_REF);
  setup_adc( ADC_CLOCK_INTERNAL );
  set_adc_channel( 0 );

  do {
        value = Read_ADC();
        delay_ms(100);
        set_tris_b(0);
           Port_b = value;
  } while (TRUE);
}


I am having an error of unidentified identifier on (Port_b = value) line.

Dean Matthews

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\11\06@084616 by Dale Botkin

flavicon
face
You would need to use either this:

output_b(value);

or this:

#byte port_b = 6

port_b = value;

You're getting an error because the compiler does not grok "port_b",
unless you've defined it somewhere.

Dale
--
Hallo, this is Linus Torvalds and I pronounce Linux as Leennuks.
Hallo, this is Bill Gates and I pronounce 'crap' as 'Windows'.

On Tue, 6 Nov 2001, MATTHEWS, DEAN (D.) wrote:

{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2001\11\06@101209 by D Lloyd

flavicon
face
part 1 2241 bytes content-type:text/plain; charset=us-ascii
Hi,

Is it not because of the upper case "P"/also? Presumably (uh-oh, out rolls
the "presumably"), the compiler knows about "port_b" because it is used in
the "#use fast_IO"  but knows zippo about the "Port_b".

Dan





(Embedded     Dale Botkin <.....daleKILLspamspam.....BOTKIN.ORG>KILLspamspam.....MITVMA.MIT.EDU>
image moved   06/11/2001 13:44
to file:
pic21607.pcx)





Please respond to pic microcontroller discussion list
     <EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU>
Sent by:  pic microcontroller discussion list <PICLISTspamspam_OUTMITVMA.MIT.EDU>


To:   @spam@PICLISTKILLspamspamMITVMA.MIT.EDU
cc:
Subject:  Re: [PIC]:help using CCS C code

Security Level:?         Internal


You would need to use either this:

output_b(value);

or this:

#byte port_b = 6

port_b = value;

You're getting an error because the compiler does not grok "port_b",
unless you've defined it somewhere.

Dale
--
Hallo, this is Linus Torvalds and I pronounce Linux as Leennuks.
Hallo, this is Bill Gates and I pronounce 'crap' as 'Windows'.

On Tue, 6 Nov 2001, MATTHEWS, DEAN (D.) wrote:

> To all,
>
> I am trying to build the code below using a CCS C compiler without any
joy. Originally I printed out the A2D conversion using the printf and rs232
function.  Now I want to display the hex number in 'value' using 10 leds -
10bit a2d result.
{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body






part 2 165 bytes content-type:application/octet-stream; (decode)

part 3 136 bytes
--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamBeGonelistservspamBeGonespammitvma.mit.edu with SET PICList DIGEST in the body


2001\11\06@104217 by Max Peelman

flavicon
face
   Hi,

   The CCS compiler is case-insensitive by default. This is changed through
the #case preprocessor directive, which is missing from the code listing
supplied. Therefore, "port_b" and "Port_b" should be regarded the same
unless the #case directive is used outside of the snippet provided.

   Good day,

   Max Peelman

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Max Peelman
Creative Concepts & Designs, Inc.
http://www.CCandD.com
TakeThisOuTMax.PeelmanEraseMEspamspam_OUTCCandD.com
419-757-0524 Phone
419-757-1404 Fax
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Dan wrote:
{Quote hidden}

rs232
{Quote hidden}

line.
> >
> > Dean Matthews
> >

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2001\11\06@104635 by Lawrence Lile

flavicon
face
CCS is case insensitive by default, so

port_B == PoRt_b.

Don't be like me and develop bad habits with a case insensitive compiler,
try to be consistent about capitalization.

Yes, you need to explicilty define port_b.

#byte port_b = 6

and also, you've defined "value" as a long.  You may get unexpected results
by assigning a port (8 bit) to a long (16 bit in CCS).

If you explicitly state in your include file,

#DEVICE pic16f877 ADC=10

then read_ADC() will give you a long, packed with the two most signifigant
bits in the upper byte.    To convert the 10-bit value to 8 bits you may
need to shift right twice to truncate it to 8 bits.

--Lawrence

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservEraseMEspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2001\11\06@111537 by D Lloyd

flavicon
face
part 1 2603 bytes content-type:text/plain; charset=us-ascii
Hi,

Shows how much I use the compiler ;-) I forget that it is non-Ansi.

Dan




(Embedded     Max Peelman <EraseMEMax.PeelmanspamCCANDD.COM>spamMITVMA.MIT.EDU>> image moved   06/11/2001 15:34
to file:
pic18497.pcx)





Please respond to pic microcontroller discussion list
     <
RemoveMEPICLISTEraseMEspamEraseMEMITVMA.MIT.EDU>
Sent by:  pic microcontroller discussion list <RemoveMEPICLISTspam_OUTspamKILLspamMITVMA.MIT.EDU>


To:   RemoveMEPICLISTTakeThisOuTspamspamMITVMA.MIT.EDU
cc:
Subject:  Re: [PIC]:help using CCS C code

Security Level:?         Internal


   Hi,

   The CCS compiler is case-insensitive by default. This is changed
through
the #case preprocessor directive, which is missing from the code listing
supplied. Therefore, "port_b" and "Port_b" should be regarded the same
unless the #case directive is used outside of the snippet provided.

   Good day,

   Max Peelman

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Max Peelman
Creative Concepts & Designs, Inc.
http://www.CCandD.com
EraseMEMax.PeelmanspamspamspamBeGoneCCandD.com
419-757-0524 Phone
419-757-1404 Fax
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Dan wrote:
>
> Hi,
>
> Is it not because of the upper case "P"/also? Presumably (uh-oh, out
rolls
> the "presumably"), the compiler knows about "port_b" because it is used
in
{Quote hidden}

rs232
{Quote hidden}

line.
> >
> > Dean Matthews
> >

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body





part 2 165 bytes content-type:application/octet-stream; (decode)

part 3 136 bytes
--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservSTOPspamspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2001\11\06@120512 by Dale Botkin

flavicon
face
On Tue, 6 Nov 2001, D Lloyd wrote:

> Is it not because of the upper case "P"/also? Presumably (uh-oh, out rolls
> the "presumably"), the compiler knows about "port_b" because it is used in
> the "#use fast_IO"  but knows zippo about the "Port_b".

Nope, CCS is case insensitive by default, so that's most likely not the
problem.  And oddly enough, though port_b is used in the preprocessor
directive #use fast_io, it's not actually defined in th sense that you can
use it as a variable.  And I think there's a reason for that:  I may want
to define port_b as a variable, which is treated like any other variable
and can be stored anywhere in RAM.  I may instead want to use the #byte
directive to specify *where* in memory port_b is located.  So in this case
port_b is local to the #use fast_io preprocessor directive.  Confusing
enough?  8-)

Dale

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamBeGonelistservSTOPspamspamEraseMEmitvma.mit.edu with SET PICList DIGEST in the body


2001\11\07@062938 by dr. Imre Bartfai

flavicon
face
You should define your Port_b like

#byte Port_b=6

This is a directive - a CCS speciality.

I hope this helps.

Imre

On Tue, 6 Nov 2001, MATTHEWS, DEAN (D.) wrote:

{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspamEraseMEmitvma.mit.edu


2001\11\08@031449 by MATTHEWS, DEAN (D.)

picon face
What is the function of the 6 in:  #byte Port_b=6

Dean Matthews


You should define your Port_b like

#byte Port_b=6

This is a directive - a CCS speciality.

I hope this helps.

Imre

On Tue, 6 Nov 2001, MATTHEWS, DEAN (D.) wrote:

{Quote hidden}

--
http://www.piclist.com hint: To leave the PICList
spamBeGonepiclist-unsubscribe-requestspamKILLspammitvma.mit.edu

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\11\08@035749 by MATTHEWS, DEAN (D.)

picon face
Dale,

So do I need to use #byte port_b=6  and  #use fast IO(port_b) at the top of the program and then after the set_tris_b(0); type in port_b=value in the main program?

Dean Matthews

{Original Message removed}

2001\11\08@050144 by Alan Gorham

flavicon
face
>What is the function of the 6 in:  #byte Port_b=6
>
>Dean Matthews
>


Hi Dean

6 is the address of PORTB in memory, if I'm not mistaken!

Alan

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\11\08@073830 by Dale Botkin

flavicon
face
Like this:

#byte port_b = 6
#use fast_io(b)         // NOT port_b...

set_tris_b(0);

port_b = value;

Dale
--
Hallo, this is Linus Torvalds and I pronounce Linux as Leennuks.
Hallo, this is Bill Gates and I pronounce 'crap' as 'Windows'.

On Thu, 8 Nov 2001, MATTHEWS, DEAN (D.) wrote:

> So do I need to use #byte port_b=6 and #use fast IO(port_b) at the top
> of the program and then after the set_tris_b(0); type in port_b=value
> in the main program?

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\11\09@050713 by dr. Imre Bartfai

flavicon
face
On Thu, 8 Nov 2001, MATTHEWS, DEAN (D.) wrote:

> What is the function of the 6 in:  #byte Port_b=6
>
> Dean Matthews

This directive tells the CCS compiler there is a symbol which should be
interpreted as a byte variable with an absolute address of 6 which is in
turn the Port B itself. For Pascal users: it remembers to the variable
type 'absolute'.
Imre

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...