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

problem with pic18f

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ENGIMK
Guest







problem with pic18f
PostPosted: Thu Mar 29, 2007 1:59 pm     Reply with quote

i use pic18f2221 and pic c v 4.013
when i make array of int16 or int32 and try to read it it read false data
i do it in simulator and i found that either the data is shifted in ram or he read from the next address from the variable i want to read
i try pic c v 4.023 the same thing happen
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 29, 2007 2:09 pm     Reply with quote

Post a small test program. Then I can install that compiler version
and look at the problem.
ENGIMK
Guest







THERE IS THE CODE
PostPosted: Thu Mar 29, 2007 2:13 pm     Reply with quote

#include <18F2221.h>
#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)




unsigned int32 step[3];
unsigned int32 remain[3];



void main()
{

unsigned int8 index;


for(index=0;index<3;index=index+1)
{

step[index]=10;
printf("index%d step=%lu\n",(byte)index, step[index]);
}

for(index=0;index<3;index=index+1)
{
remain[index]=10;
printf("index%d remain=%lu\n",(byte)index,remain[index]);
}
while(1)
{
output_high(pin_a0);
for(index=0;index<3;index++)
{
printf("index%d remain=%lu step=%lu\n",(byte)index,remain[index],step[index]);
output_low(pin_a0);
remain[index]=remain[index]-step[index];
if(remain[index] < step[index])
remain[index]=remain[index]+10;

}
}
}




I TRY IT ALSO ON PIC C V 3.249 BUT SAME THING HAPPEN
PRINTF SEND STEP=0 INSTEAD OF 10;
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 29, 2007 2:25 pm     Reply with quote

I compiled it with vs. 3.249 and ran it in the simulator for MPLAB vs. 7.20
and I got this:
Code:

index0 step=10
index1 step=10
index2 step=10
index0 remain=10
index1 remain=10
index2 remain=10
index0 remain=10 step=10
index1 remain=10 step=10
index2 remain=10 step=10
index0 remain=10 step=10
index1 remain=10 step=10
index2 remain=10 step=10
etc.

What version of MPLAB do you have ?
ENG.IMK



Joined: 29 Mar 2007
Posts: 3

View user's profile Send private message Yahoo Messenger

PostPosted: Thu Mar 29, 2007 2:27 pm     Reply with quote

I USE PICSIMULATOR
_________________
IMK
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 29, 2007 2:43 pm     Reply with quote

Here is their webpage, with screenshots at the bottom:
http://www.oshonsoft.com/pic18.html

I don't want to try to find or fix problems in their simulator.

I'm content to use MPLAB simulator.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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