Jump to content
Sign in to follow this  
Allegro

Novo Interesting State....

Recommended Posts

I live interesting state with Novo...

 

1. Code : outputs are different port and NOT PROBLEM

2. Code : outputs are same port and THERE IS PROBLEM!!!

 

Why 2. Output is different from 1 ?

And what can i do for right work... ?

 

 

Thanks...

 

Allegro

Novo_Support_1.zip

Share this post


Link to post
Share on other sites

Code from your screenshots looks ok (you don't even need to Sys_Yield, Sys_Sleep calls will cause scheduler to switch tasks). Must be something in the rest of the program.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites
I live interesting state with Novo...

 

1. Code : outputs are different port and NOT PROBLEM

2. Code : outputs are same port and THERE IS PROBLEM!!!

 

Why 2. Output is different from 1 ?

And what can i do for right work... ?

 

 

Thanks...

 

Allegro

Sounds like a read modify write issue, so maybe a problem with the simulator you use.

Create a shadow variable for the data (or use LAT registers on PIC18, microchip add these to fix such problems), set and clear bits in that variable instead of directly, then update the port with this variable.

 

unsigned char portb_shadow = 0;
...
clear_bit( portb_shadow, 0 );
portb = portb_shadow;

Sys_sleep(10);
...

 

Regards

Dave

Share this post


Link to post
Share on other sites

Shadow var needs global scope!

unsigned char portb_shadow = 0; // this variable needs to be declared globally so it can be shared between the tasks
...
clear_bit( portb_shadow, 0 );
portb = portb_shadow;

Sys_sleep(10);
...

 

Regards

Dave

Share this post


Link to post
Share on other sites

i edit my code...

And right work now.

 

Mcu : PIC16F887

 

This problem from Simulator? I want find root cause.

 

THANKS...

 

4_code.png4_output.png

Share this post


Link to post
Share on other sites
i edit my code...

And right work now.

Great.

 

Mcu : PIC16F887

 

This problem from Simulator?

Sounds like it is.

What simulator do you use?

 

Regards

Dave

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  

×