Jump to content
Paolino

Led And Button Plugins With Pic12f675

Recommended Posts

Hi guys.

I was trying to debug with SourceBoostIDE a simple code written for PIC12F675 with BoostC. A LED is connected to GPIO2 and a button is connected to GPIO5; I found problems to use the plugins LED and BUTTON since I could not assign the GPIO address. I found only PORTx in menus Configure for both plugins...

Is this my mistake? Where? Is there a workaround?

Thank you.

 

Paolo.

Share this post


Link to post
Share on other sites

Not sure I fully understand your question or this particular processor, but are the the general purpose io registers PortA......

 

So what do you expect to find? Could you add a bit more content?

Share this post


Link to post
Share on other sites
Not sure I fully understand your question or this particular processor, but are the the general purpose io registers PortA......

 

So what do you expect to find? Could you add a bit more content?

 

Russ, this is the very simple code I wrote:

 

// Comparator module off	
	cmcon=0x07;

//  ADC module off
ansel=0x00;

// GPIO TRISTATE config
trisio=0x3B;

gpio.2=1;//LED = ON;
delay_ms(200);
gpio.2=0;//LED = OFF;
delay_ms(200);

   while(1);

 

The register window is correclty updated when both "gpio.2=1" and "gpio2=0" instructions are executed, but the LED plugin does not work. That plugin is configured as led connected to PORTA pin RB2, but the led stays off (dark green or dark red).

 

Hope this help.

 

Thank you.

 

Paolo.

Edited by Paolino

Share this post


Link to post
Share on other sites

I did not realize that gpio was a defined symbol, it does not seem to be for the chip

I usually use the 16f877a. This may be a special feature of the 675 and may then

be a bug in the compiler. I would have to get the chip manual and try the compiler

for this setup. Do not have time to do this just now, will try to get to it later.

In the mean time is porta defined for the chip and if so does it work? It looks

like choosing porta for the plugin is the right choice.

 

For the 877 the led and pb plugins seem to work fine ( but with some ambiguity about

just what hardware they represent )

Share this post


Link to post
Share on other sites

Have you run thru the debugger reading and writing the port to make sure it is

getting set as you expected. This does not directly address your problem, but may tell you

something.

 

I looked at the include file for the 12F675 and there is no definition for PORT a b ... so the fact

that the led block still displays these choices seems to indicate a bug at least at some

level.

Share this post


Link to post
Share on other sites
I did not realize that gpio was a defined symbol, it does not seem to be for the chip

I usually use the 16f877a. This may be a special feature of the 675 and may then

be a bug in the compiler.

 

Russ, as you have discovered looking at the datasheet, for PIC12 series the I/O ports are not called PORT such all the other PICs, but GPIO, General Purpose I/O. PIC12F675 GPIO register is mapped to address 0x05, same address of PORTA for PIC16F series. For that reason I decided to try the LED plugin configuring it as PORTA, RB2.

 

I do not think it can be a compiler bug, because the source code is correctly compiled and linked and it works if downloaded onto a PIC12F675. If of ipothetic BUG we can talk, I think it must be found in LED, BUTTON (and other) plugins; the same code I posted, update correctly the status of the register GPIO, if I watch it in the register window.

 

Maybe Pavel and/or Dave can give an answer. I only suppose that PIC12F series can not be debugged with those plugins... :angry:

 

Thank you.

 

Paolo.

Share this post


Link to post
Share on other sites

I just had quick look and none of the plug-ins seem to support GPIO.

Probably its an oversight in the plugin program and as it such should be reported as a bug.

Share this post


Link to post
Share on other sites
I just had quick look and none of the plug-ins seem to support GPIO.

Probably its an oversight in the plugin program and as it such should be reported as a bug.

GPIO is not currently supported by the PIC simulator.

Its on the todo list, but we haven't got round to it yet :angry: .

 

Regards

Dave

Share this post


Link to post
Share on other sites
GPIO is not currently supported by the PIC simulator.

Its on the todo list, but we haven't got round to it yet :( .

 

uhhh... how about soon? I'm also starting a few projects based on the PIC12F675. It's a great, useful little chip.

 

Seriously, if you could find the time to add GPIO to the plugins (including the extra plugins), or map the GPIO to PORTA as a temporary solution, it would be greatly appreciated.

 

Thanks :)

Share this post


Link to post
Share on other sites
GPIO is not currently supported by the PIC simulator.

Its on the todo list, but we haven't got round to it yet :( .

 

uhhh... how about soon? I'm also starting a few projects based on the PIC12F675. It's a great, useful little chip.

 

Seriously, if you could find the time to add GPIO to the plugins (including the extra plugins), or map the GPIO to PORTA as a temporary solution, it would be greatly appreciated.

 

Thanks :)

 

As a workaround switch the compiler to a different chip and run the simulator there, when the led is working to your satisfaction switch back. Pick a chip as similar to the 675 as you can but with a portn. C should be portable so most differences go away.

 

Russ

Share this post


Link to post
Share on other sites

Try using the PIC16F630 to develope your code. It is very similar and you could probably plug it into the same 8 pin socket with a few legs hanging over the edge (port C, lower 6 pins). OR, even the PIC16F676 for the adc version.

 

Add this to the top of your file and you are off and running.

 

#define gpio porta
#define trisio trisa

 

Cheers

 

Reynard

Edited by Reynard

Share this post


Link to post
Share on other sites

Thanks for the tips guys. Of course, you're right and I have been using other part numbers for the moment. I am trying to standardize on just a few PIC parts, but that's a clever tip for using a 16F630. I may have to get one.

 

It does seem to me that adding GPIO would be an easy fix to the plugins; most go up to PORTK :) which I don't think many of us use... so maybe it could become GPIO...?

 

How 'bout it, Dave? :(

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...