|
|
View previous topic :: View next topic |
Author |
Message |
anitha
Joined: 16 Aug 2013 Posts: 6
|
serial programming not working |
Posted: Thu Sep 26, 2013 4:16 am |
|
|
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
|
|
Posted: Thu Sep 26, 2013 6:04 am |
|
|
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 |
|
|
|
|
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
|