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

serial programming not working

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



Joined: 16 Aug 2013
Posts: 6

View user's profile Send private message

serial programming not working
PostPosted: Thu Sep 26, 2013 4:16 am     Reply with quote

Serial programming not working while using switch...i tried in proteus...
here is the code...
Code:

#include<18f4520.h>
#fuses XT,NOWDT
#use delay(clock=4000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_c7)

#define SWITCH_PIN PIN_B5

void main()
{
int i;
//int SW;
 
if(input(SWITCH_PIN)==1)
{
long int a[]={20, 96, 21, 114, 22, 88, 23, 5, 147, 159, 194, 134, 140};
for(i=0;i<=a[i]+2;i++)
  {
         printf("%ld",a[i]);
         delay_ms(100);
  }
}
}
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Thu Sep 26, 2013 6:04 am     Reply with quote

Hi,

First of all, we don't deal with Proteus questions here for the simple reason that it's (almost) impossible to tell if a problem is Proteus related, or compiler
related, and none of us want to chase our tails working on Proteus bugs....

Having said that, there is a glaring problem in your code. You do not want to declare variables "in-line" like you've declared your 'a[]' array. Moreover,
it's being re-declared each time the loop executes. Move this declaration to the top of Main().

Also, your topic heading is misleading. I assume you mean that 'printf' is not working, right? Your topic heading implies that you can't program your part using
ICSP. You should edit it!

John
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