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.

Hi-Tech PICC weirdness

Status
Not open for further replies.

futz

Active Member
Why doesn't this example, taken directly from O'Reilly's **broken link removed** work in PICC Lite?

Here's a pic of it in the MPLAB sim after looping for a while:
bleh.JPG

Unless I've missed something, that's a $1000 compiler with a seriously bad bug. I've probably missed something stupid. :p

This test was done because I have had trouble doing similar things in my GLCD code and in my GP2D12 code. Had to declare the array empty and initialize it inside main. Stupid...
 
Last edited:

futz

Active Member
Oh! This IS weird! I plugged the exact same code into C30 and it works as expected. No problems with C30 - only PICC is screwed up.

There are examples in the PICC manual that look just like that code. Wonder what's going on?

Screen cap of C30 doing it:
bleh.JPG
 
Last edited:

blueroomelectronics

Well-Known Member
I'd like to wrap a kit around the dsPIC30F4013, standard fare. Keypad, LCD, pots, breadboard, ICD connector. Not sure what would make it unique though.
 

futz

Active Member
blueroomelectronics said:
I'd like to wrap a kit around the dsPIC30F4013, standard fare. Keypad, LCD, pots, breadboard, ICD connector. Not sure what would make it unique though.
It's just a speedy 16-bit PIC, nothing special, but with DSP. But if you could come up with an idea that would let us do something interesting with its DSP features, probably something with audio ins and outs, that would be cool. I know next to nothing about that part of it though.
 
Last edited:
BoostC and C18

Well it also works ok in BoostC for a 16F628A and in C18 for a 18F1320.
:confused:

Haven't done the one you broke on yet.
 

BeeBop

Active Member
August Treubig said:
Well it also works ok in BoostC for a 16F628A and in C18 for a 18F1320.
:confused:

Haven't done the one you broke on yet.

I think SourceBoost ROCKS! For its little-bitty price tag, it sure seems to keep up with the high end.

Pointers to constants is SUPPOSED to be what hiTech is good at!
 
Last edited:
BoostC

That's what I think to.

Haven't convinced Futz or Bill to try it. I started out with the free one and then ended up (currently) on the $30 standard one. It works for both 16 and 18 series chips and integrates nicely into MPLAB or you can use their IDE which is nice.

While they don't have quite as many "libraries" as C18, what they provide is in source form. I use their LCD and their Serial routines a lot.

:D
 

futz

Active Member
August Treubig said:
Haven't convinced Futz or Bill to try it.
I downloaded it but haven't installed yet. With PICC's very strange behaviour starting to really bug me, I'm about to do it.

I picked an example right out of PICC's manual that does almost exactly what my test above does. It doesn't work. :D:D:D Does the same as my test. No init of the array.

I started out with the free one and then ended up (currently) on the $30 standard one. It works for both 16 and 18 series chips and integrates nicely into MPLAB or you can use their IDE which is nice.
Their prices are very reasonable.
 

BeeBop

Active Member
August Treubig said:
That's what I think to.

Haven't convinced Futz or Bill to try it. I started out with the free one and then ended up (currently) on the $30 standard one. It works for both 16 and 18 series chips and integrates nicely into MPLAB or you can use their IDE which is nice.

While they don't have quite as many "libraries" as C18, what they provide is in source form. I use their LCD and their Serial routines a lot.

:D
Yes, I'd have to agree. At least the libraries with C18 come with source and are rebuild-able, Microchip even makes it easy to recompile all with a batch file. Contrasted with CCS, or, I believe Mikro C, both of which provide tons of libraries, which the user has NO access to. Mikro C, as far as I know, doesn't even integrate into MPLab!

Not having libraries is not such a bad thing; it forces you to write your own, and understand how they work, and how they fail. It is, however, a lot of work. :D
 

blueroomelectronics

Well-Known Member
I'll take a look, I assume there is a free demo version.

Here's the rub, for 18F I see nothing wrong with C18 after all Microchip supports it and their ENC28J60 module is written with it. As for the 24/30/33 I would think most people go with C30. For baseline PICs if I was doing anything complex enough that I would want C I'd use an 18F PIC instead. The 16F and 12F were really not ideal C PICs and most have 18F replacements, the 12F is best with assembler IMO.
If I just want to bash out some quick code I use Swordfish BASIC, you've gotta hand it to the Swordfish fellows as it just simply works. You don't even need MPLAB as it has an excellent IDE, too bad no debug support.
 

futz

Active Member
Screw it. I have SourceBoost BoostC installed and am just making the necessary changes to the code (pragma's and includes and such).

It doesn't integrate as well as I'd like "out of the box" (yes, I did click the button when installing), but I'm sure that's fixable. Need to spend some time with the manual.

If I'm happy with it I'll buy a license.
 

BeeBop

Active Member
blueroomelectronics said:
I'll take a look, I assume there is a free demo version.

Here's the rub, for 18F I see nothing wrong with C18 after all Microchip supports it and their ENC28J60 module is written with it. As for the 24/30/33 I would think most people go with C30. For baseline PICs if I was doing anything complex enough that I would want C I'd use an 18F PIC instead. The 16F and 12F were really not ideal C PICs and most have 18F replacements, the 12F is best with assembler IMO.
If I just want to bash out some quick code I use Swordfish BASIC, you've gotta hand it to the Swordfish fellows as it just simply works. You don't even need MPLAB as it has an excellent IDE, too bad no debug support.

For the most part, I do agree; Microchip's own tools, even the free ones work so very well, better than most. However there are times when I need a quick hack with a 16f part (and I still have a lot of these, even the ugly f84s laying around,) and use C.
I have yet to try Swordfish, and really should give it a go, after all the good I have heard about it. Does IT integrate, if you wish, though?
 

BeeBop

Active Member
futz said:
Screw it. I have SourceBoost BoostC installed and am just making the necessary changes to the code (pragma's and includes and such).

It doesn't integrate as well as I'd like "out of the box" (yes, I did click the button when installing), but I'm sure that's fixable. Need to spend some time with the manual.

If I'm happy with it I'll buy a license.

Yes, It will integrate. Try firing up MPLab and see if it is listed in your tools.

I recall reading a lot, and when I first started, recall writing an implementation of formated printing (printf())
 

futz

Active Member
OK, you BoostC guys. How do I put just a "asm nop" inline? I've tried bunches of different variations. Not sure what's correct. This seems to generate the fewest errors:
Code:
asm {nop}

How do I make my F10 build key work again?

When I have a compile error, how do I make it go to the offending line when I double-click? (Rather than the slow way of having to select the source pane, hit CTRL-G and type my line number.)

I'm getting errors that I just can't find the source of the problem.
 
Last edited:

BeeBop

Active Member
OK, you BoostC guys. How do I put just a "asm nop" inline? I've tried bunches of different variations. Not sure what's correct.
You should be able to do it that way?

asm nop

Are you putting a semi-colon after it? Don't.


How do I make my F10 build key work again?
I'm not sure, I usually just click. :red face
When I have a compile error, how do I make it go to the offending line when I double-click?

I don't think you can, YET, although I haven't used it since I've updated it.
 

futz

Active Member
BeeBop said:
You should be able to do it that way?

Code:
asm nop
That won't work at all. I have to do
Code:
asm {nop}
or I have a huge string of errors.

Are you putting a semi-colon after it? Don't.
No. I found out about that one pretty quick.

I'm not sure, I usually just click. :red face
Ew! I use the evil mouse as little as possible. Carpal problems from too many years of computing.

I don't think you can, YET, although I haven't used it since I've updated it.
This thing is complaining about "missing right paren", "missing semicolon"s and "failure", but I can't find any... so far. It compiled fine in PICC.
 

eng1

New Member
futz, what happens if you add an endless loop after the existing one? I think that the original program was not properly terminated for Hi-Tech PICC compiler.

Code:
#include <htc.h>

__CONFIG(XT & WDTDIS & LVPDIS);

int array[] = {4,5,8,9,8,1,0,1,9,3};
int index;
    
int main(){
    int y = 0;
    index = 0;
    while (array[index] != 0){
        y = array[index];
        ++index;    
    }    

    while(1);     // <<<<<<<<<<<
    
}
 
Status
Not open for further replies.

Latest threads

Top