CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Need help on stepper motor program
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
tong143



Joined: 09 May 2011
Posts: 14

View user's profile Send private message

PostPosted: Sun May 15, 2011 12:42 pm     Reply with quote

I already have a board with PIC16F72. I can not go for new board. Can you suggest me a PIC which can be used with the same board and pickit2.

PCM programmer wrote:
You're right. I think Microchip lied. The link that I posted says they
support the 16F72 with Pickit 2 in vs. 8.66. But then if I go to the Select
Device screen in MPLAB vs. 8.66, it says no support for Pickit 1 and
Pickit 2. Only Pickit 3 is supported.

My advice is to choose a different PIC. Use the Configure / Select Device
screen in MPLAB to see what devices are really supported for Pickit 2.
Then buy a PIC that is supported.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun May 15, 2011 12:50 pm     Reply with quote

You could use a 16F882. It's the same pinout, but with more features
on each i/o pin. You don't have to use those features.
http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en530146
It's supported by Pickit 2.
tong143



Joined: 09 May 2011
Posts: 14

View user's profile Send private message

PostPosted: Sun May 15, 2011 1:05 pm     Reply with quote

So It will not have any issues with the board, will it?
PCM programmer wrote:
You could use a 16F882. It's the same pinout, but with more features
on each i/o pin. You don't have to use those features.
http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en530146
It's supported by Pickit 2.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun May 15, 2011 3:06 pm     Reply with quote

The pinouts are the same. The only issues that might exist can be solved
by programming, which is easy.
tong143



Joined: 09 May 2011
Posts: 14

View user's profile Send private message

PostPosted: Thu May 19, 2011 2:04 pm     Reply with quote

Hi
To start with I have written a program using mikroC, for pic16f882 using 4 MHz external crystal oscillator, to increase and decrease a number based on input from RA1/RA2 and display on multiplexed 7 segment display. 1s position is controlled by RA3 and 10s position is controlled by RA4. It is a common cathode. I am usin real pic simulator for simulation. The sequence is not followed while increase or decrease operations and both the digits are showing the same value. Following is the program. Shall someone help me on this.

unsigned char seg[10]={0x80,0xf2,0x48,0x60,0x32,0x24,0x04,0xF0,0x00,0x30};
unsigned short i, DD0=0x80,DD1=0x80;
unsigned int tc,k=0,t1c;
void display_temp(short DD0, short DD1)
{
for (i=0;i<1;i++)
{
TMR1IE_bit=1;
while(!TMR1IF_bit )
{
PORTC = seg[DD0];
PORTA.f3= 1; // Select Ones Digit
PORTA.f4= 0;
delay_ms(1);
PORTC = seg[DD1];
PORTA.f3= 0;
PORTA.f4= 1; // Select Tens Digit
delay_ms(1);
if(PORTA.f0==1 || PORTA.f1 == 1 || PORTA.f2 == 1)
{
TMR1IE_bit=0;
TMR1IF_bit=0;
break;
}
}
TMR1H=0x9E; //begin with 0
TMR1L=0x58;
TMR1IE_bit=0;
TMR1IF_bit=0;
if(PORTA.f0==1 || PORTA.f1 == 1 || PORTA.f2 == 1)
break;
}
return;
}


void main()
{
int tc=0,count=0,set=0, t1,t1c=0;
GIE_bit=1;
TRISA=0xE7; // Set PORTA
TRISC=0x01; // set PORTC as OUTPUT except pin0
PORTA=0x00;
PORTC=0x80;
ANSEL=0x00;
ANSELH=0x00;
T1CON=0x01; //tmr1on bit is set
TMR1H=0x9E; //begin with 0
TMR1L=0x58;
while(1)
{
if(PORTA.f2==1)
{
if(tc==0) tc=67;
else tc--;
}
if(PORTA.f1==1)
{
if(tc==67) tc=0;
else tc++;
}
DD0 = tc%10;
DD1 = tc/10;
display_temp(DD0,DD1);
TMR1IE_bit=0;
TMR1IF_bit=0;
}
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu May 19, 2011 2:07 pm     Reply with quote

Quote:
I have written a program using mikroC

If you are using MikroC you should ask questions on the MikroC forum:
http://www.mikroe.com/forum/
Apparently all this time you were using MikroC. You never said you
were using CCS. You definitely need to move to the MikroC forum.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group