Jump to content
Sign in to follow this  
TomF

Bug With Static Unsigned Char Initialization

Recommended Posts

I believe i have a bug with static volatile unsigned char:

I have sent you my project via email. Can you please let me know if you have received it please.

		static volatile unsigned char nDisplayId = 0;					// Indictes which display needs updating.
03A7  0020  	MOVLB 0x00
03A8  11EF  	BCF CompGblVar54,3
03AB  11EF  	BCF CompGblVar54,3
03B0  11EF  	BCF CompGblVar54,3
03B5  11EF  	BCF CompGblVar54,3
03BA  11EF  	BCF CompGblVar54,3
03BF  11EF  	BCF CompGblVar54,3
03C4  11EF  	BCF CompGblVar54,3
03C9  11EF  	BCF CompGblVar54,3
03CE  11EF  	BCF CompGblVar54,3
03D3  11EF  	BCF CompGblVar54,3
03D8  11EF  	BCF CompGblVar54,3
03DD  11EF  	BCF CompGblVar54,3
03E3  0020  	MOVLB 0x00
03E4  11EF  	BCF CompGblVar54,3
03EA  0020  	MOVLB 0x00
03EB  11EF  	BCF CompGblVar54,3
03F1  0020  	MOVLB 0x00
03F2  11EF  	BCF CompGblVar54,3
03F8  0020  	MOVLB 0x00
03F9  11EF  	BCF CompGblVar54,3
03FF  0020  	MOVLB 0x00
0400  11EF  	BCF CompGblVar54,3
0406  0020  	MOVLB 0x00
0407  11EF  	BCF CompGblVar54,3
040D  0020  	MOVLB 0x00
040E  11EF  	BCF CompGblVar54,3
0414  0020  	MOVLB 0x00
0415  11EF  	BCF CompGblVar54,3
041B  0020  	MOVLB 0x00
041C  11EF  	BCF CompGblVar54,3
0422  0020  	MOVLB 0x00
0423  11EF  	BCF CompGblVar54,3
0429  0020  	MOVLB 0x00
042A  11EF  	BCF CompGblVar54,3
0430  0020  	MOVLB 0x00
0431  11EF  	BCF CompGblVar54,3
0437  0020  	MOVLB 0x00
0438  11EF  	BCF CompGblVar54,3
043E  0020  	MOVLB 0x00
043F  11EF  	BCF CompGblVar54,3
0445  0020  	MOVLB 0x00
0446  11EF  	BCF CompGblVar54,3
044C  0020  	MOVLB 0x00
044D  11EF  	BCF CompGblVar54,3
0453  0020  	MOVLB 0x00
0454  11EF  	BCF CompGblVar54,3
045A  0020  	MOVLB 0x00
045B  11EF  	BCF CompGblVar54,3
0461  0020  	MOVLB 0x00
0462  11EF  	BCF CompGblVar54,3
0468  0020  	MOVLB 0x00
0469  11EF  	BCF CompGblVar54,3
046F  0020  	MOVLB 0x00
0470  11EF  	BCF CompGblVar54,3
0476  0020  	MOVLB 0x00
0477  11EF  	BCF CompGblVar54,3
047D  0020  	MOVLB 0x00
047E  11EF  	BCF CompGblVar54,3
0484  0020  	MOVLB 0x00
0485  11EF  	BCF CompGblVar54,3
048B  0020  	MOVLB 0x00
048C  11EF  	BCF CompGblVar54,3
0492  0020  	MOVLB 0x00
0493  11EF  	BCF CompGblVar54,3
0499  0020  	MOVLB 0x00
049A  11EF  	BCF CompGblVar54,3
04A0  0020  	MOVLB 0x00
04A1  11EF  	BCF CompGblVar54,3
04A7  0020  	MOVLB 0x00
04A8  11EF  	BCF CompGblVar54,3
04AE  0020  	MOVLB 0x00
04AF  11EF  	BCF CompGblVar54,3
04B5  0020  	MOVLB 0x00
04B6  11EF  	BCF CompGblVar54,3
04BC  0020  	MOVLB 0x00
04BD  11EF  	BCF CompGblVar54,3
04C3  0020  	MOVLB 0x00
04C4  11EF  	BCF CompGblVar54,3
04CA  0020  	MOVLB 0x00
04CB  11EF  	BCF CompGblVar54,3
04D1  0020  	MOVLB 0x00
04D2  11EF  	BCF CompGblVar54,3
04D8  0020  	MOVLB 0x00
04D9  11EF  	BCF CompGblVar54,3
04DF  0020  	MOVLB 0x00
04E0  11EF  	BCF CompGblVar54,3
04E6  0020  	MOVLB 0x00
04E7  11EF  	BCF CompGblVar54,3
04ED  0020  	MOVLB 0x00
04EE  11EF  	BCF CompGblVar54,3
04F4  0020  	MOVLB 0x00
04F5  11EF  	BCF CompGblVar54,3
04FB  0020  	MOVLB 0x00
04FC  11EF  	BCF CompGblVar54,3
0502  0020  	MOVLB 0x00
0503  11EF  	BCF CompGblVar54,3
050D  11EF  	BCF CompGblVar54,3
0515  11EF  	BCF CompGblVar54,3
051A  11EF  	BCF CompGblVar54,3
051F  11EF  	BCF CompGblVar54,3
0524  11EF  	BCF CompGblVar54,3
0528  11EF  	BCF CompGblVar54,3
052D  11EF  	BCF CompGblVar54,3
0532  11EF  	BCF CompGblVar54,3
0537  11EF  	BCF CompGblVar54,3
053C  11EF  	BCF CompGblVar54,3
0541  11EF  	BCF CompGblVar54,3
0546  11EF  	BCF CompGblVar54,3
054B  11EF  	BCF CompGblVar54,3
0550  11EF  	BCF CompGblVar54,3
0555  11EF  	BCF CompGblVar54,3
055A  11EF  	BCF CompGblVar54,3
055F  11EF  	BCF CompGblVar54,3
0563  11EF  	BCF CompGblVar54,3
0568  11EF  	BCF CompGblVar54,3
056D  11EF  	BCF CompGblVar54,3
0572  11EF  	BCF CompGblVar54,3
0577  11EF  	BCF CompGblVar54,3
057C  11EF  	BCF CompGblVar54,3
0581  11EF  	BCF CompGblVar54,3
0586  11EF  	BCF CompGblVar54,3
058B  11EF  	BCF CompGblVar54,3
058F  11EF  	BCF CompGblVar54,3
0594  11EF  	BCF CompGblVar54,3
0599  11EF  	BCF CompGblVar54,3
059D  11EF  	BCF CompGblVar54,3
05A2  11EF  	BCF CompGblVar54,3
05A7  11EF  	BCF CompGblVar54,3
05AC  11EF  	BCF CompGblVar54,3
05B1  11EF  	BCF CompGblVar54,3
05B6  11EF  	BCF CompGblVar54,3
05BB  11EF  	BCF CompGblVar54,3
05C0  11EF  	BCF CompGblVar54,3
05C5  11EF  	BCF CompGblVar54,3
05CA  11EF  	BCF CompGblVar54,3
05CF  11EF  	BCF CompGblVar54,3
05D4  11EF  	BCF CompGblVar54,3
05D8  11EF  	BCF CompGblVar54,3
05DD  11EF  	BCF CompGblVar54,3
05E2  11EF  	BCF CompGblVar54,3
05E7  11EF  	BCF CompGblVar54,3
05EC  11EF  	BCF CompGblVar54,3
05F1  11EF  	BCF CompGblVar54,3
05F6  11EF  	BCF CompGblVar54,3
05FB  11EF  	BCF CompGblVar54,3
05FF  11EF  	BCF CompGblVar54,3
0604  11EF  	BCF CompGblVar54,3
0609  11EF  	BCF CompGblVar54,3
060E  11EF  	BCF CompGblVar54,3
0613  11EF  	BCF CompGblVar54,3
0617  11EF  	BCF CompGblVar54,3
061B  11EF  	BCF CompGblVar54,3
061F  11EF  	BCF CompGblVar54,3
0667  19EF  	BTFSC CompGblVar54,3
0668  2E6B  	GOTO	label47
0669  01F4  	CLRF interrupt_57_nDisplayId
066A  15EF  	BSF CompGblVar54,3
066B        label47

Share this post


Link to post
Share on other sites

Shameless bump- its been a week and no response from the developers.....

We don't seem to have the project, please re-send to support@sourceboost.com

 

Regards

Dave

Share this post


Link to post
Share on other sites

Create an interrupt function, add a static volatile unsigned char to the function:

 

void interrupt()
{
static volatile unsigned char nDisplayId = 0;

nDisplayId++;

}

 

 

Share this post


Link to post
Share on other sites

TomF,

 

Create an interrupt function, add a static volatile unsigned char to the function:

 

void interrupt()

{

static volatile unsigned char nDisplayId = 0;

 

nDisplayId++;

 

}

This does seem to be a problem.

The work around for now is to move these variable declarations outside the function body.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Hi

 

 

Create an interrupt function, add a static volatile unsigned char to the function:

 

void interrupt()
{
static volatile unsigned char nDisplayId = 0;

nDisplayId++;

}

 

I'm a bit curious about this one, what target device are you using?

 

I tried the above code, plus a simple "while(1);nop();" main() function and couldn't replicate the problem in SB 7.20

I tried for almost all PICs I have available (16F886, 16F1827, 18F8722, 18F47J53) both with "debug" and "release" builds.

 

I would like to know wich target you are using, just to keep an eye open for this bug if someday I need to use the same device.

 

 

Thanks for your attention.

 

Best regards

Jorge

Edited by JorgeF

Share this post


Link to post
Share on other sites

 

I believe i have a bug with static volatile unsigned char:

I have sent you my project via email. Can you please let me know if you have received it please.

 

What target and what compiler version did you use? I tried under 7.20 and could not reproduce the problem.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

16F1827, release build and v7.20 compiler.

 

I've started a new project and, worryingly, i cant reproduce.

 

Can you please give me an email address and i'll email you the project that does reproduce the error for investigation.

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum 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...
Sign in to follow this  

×