Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

mikroC PRO Question

Status
Not open for further replies.

Dalaran

New Member
Finally got my easypic6 in from mikroElektronika. I am having some issues using my previous code.

When I try to assign ADIE = 1; ADIF = 0; RC0 = 0; RC1 = 0; etc, etc, I get an error when I try to compile.

The error reads "Assigning to non-lvalue 'ADIE'"

Any ideas what might be causing this?

Thanks.
 
...

When I try to assign ADIE = 1; ADIF = 0; RC0 = 0; RC1 = 0; etc, etc, I get an error when I try to compile.

The error reads "Assigning to non-lvalue 'ADIE'"

Any ideas what might be causing this?
Thanks.

It looks like is saying it does not know what ADIE is. Since ADIE is unknown it can not be used as a lvalue. An lvalue is the variable on the LHS (Left Hand Side) of an assignment.

I expect you forgot to include the processor definition (include) file in your source in the the project. Or you are building for the wrong processor.
 
Last edited:
Hmm weird, because I was using the GODONE command in my original code to start the ADC. When i complied the first time it said 'Undeclared Identifier 'GODONE'", which was different from the errors its giving me for ADIF/RC1/RC2 etc. It is also not giving me errors for my delay commands so it seems that it is picking that up fine.

The htc.h file is also included in the source code and located under the header files.

Thanks.
 
I have changed the code to use the commands
Code:
#define bitset(var,bitno) (var|=1<<bitno)
#define bitclr(var,bitno) (var&=~(1<<bitno))

to set and clear bits as apposed to RC0/RC1/ADIF etc and the code is working correctly.

Any ideas why? Can these short hand commands not be used in mikroC?

Thanks.
 
You don't need to mess with setting bits by using clumsy macros!

MikroC features some non-ansi C features specifically designed to support PIC pins and registers etc.

Instead of;
RC0 = 1;

use;
PORTC.F0 = 1;

And CONGRATS on going with the big guns in development boards! You won't be disappointed in the EasyPIC6. :)
 
Thanks RB, for the recommendation of the EasyPIC6 as well as the syntax help! Didn't realize an F was needed before the bit number. For the life of me couldn't figure out how to set/check a certain bit. Again thanks for the help. So far I am very pleased with the features and ease of use of the board. Only thing I am missing is a chip extractor... tweezers just don't cut it!

Again, much appreciated.
 
I hear you on the extractor. I have a squeeze type chip extractor with 2 tiny metal hooks that works well.

The other thing I did was use the soldering iron tip to melt some channels in the ends of the sockets. This looks messy but helps a lot, and only takes a few seconds to do;
**broken link removed**

And if you have a GLCD, touchpanel and a 18F452 I recently did a digital RS232 storage CRO project that works on the EasyPIC6;
Some EasyPIC6 projects

**broken link removed**
 
Thanks again. Always thought about buying an extractor but it never bothered me much with the 14pinners, but anything larger can be quite a pain (had a hell of a time removing that F887 that came with the platform lol). And the melting of the edges doesn't sound like a bad idea... I've already gotten into the habit of not fully inserting the chip so that it is easy to get out tisk tisk.

Very please with the board though, cheers!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top