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

example program EX_SQW works with one pin, but not another

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



Joined: 15 Jun 2007
Posts: 7

View user's profile Send private message Yahoo Messenger

example program EX_SQW works with one pin, but not another
PostPosted: Thu Jun 21, 2007 8:50 am     Reply with quote

The EX_SQW.c example code included with the CCS compiler works just fine on my PICkit2 debug express demo board (16F887), if I leave the pin at PIN_B0, It does NOT work when simply changing the output pin to PIN_A5.
I have also tried including the line: #use standard_io, it makes no difference.

I'm lost as to why this simple change breaks the program.. Any thoughts?
Thanks.

    void main() {

    printf("Press any key to begin\n\r");
    getc();
    printf("1 khz signal activated\n\r");

    while (TRUE) {
    output_high(PIN_B0);
    delay_us(500);
    output_low(PIN_B0);
    delay_us(500);
    }
    }
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Thu Jun 21, 2007 11:54 am     Reply with quote

I got a nice square wave with the PICDEM 2 plus and rev3.249
NOTE THAT THIS IS 16F877 NOT 16F887.. but software seems OK
Code:
#include <16F877.h>
#device *=16
#use delay(clock=10000000)
#fuses hs,nowdt,nolvp,protect,put,nobrownout
#use rs232(baud=19200,xmit=PIN_E0,INVERT,stream=DEBUG) // STDERR(same as DEBUG)
#case
#zero_ram
void main() {
  setup_adc_ports(NO_ANALOGS);

  fprintf(DEBUG,"Press any key to begin\n\r");

  fprintf(DEBUG,"1 khz signal activated\n\r");

  while (TRUE) {
    output_high(PIN_A5);
    delay_us(500);
    output_low(PIN_A5);
    delay_us(500);
  }
}


Last edited by treitmey on Fri Jun 22, 2007 7:36 am; edited 2 times in total
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Thu Jun 21, 2007 6:24 pm     Reply with quote

I had a similar problem recently. See this thread http://www.ccsinfo.com/forum/viewtopic.php?t=31075. The discussion began with an interrupt problem, but them PCM suggested interrupt itself was not the source of the problem.
_________________
Read the label, before opening a can of worms.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 21, 2007 8:29 pm     Reply with quote

Quote:
It does NOT work when simply changing the output pin to PIN_A5.

1. Post your compiler version. You can find it at the start of the .LST
file for your project. The .LST file is in your project directory.
The compiler version is a 4-digit number such as 3.249, 4.041, etc.

2. Confirm the PIC that you're using. Is it 16F877 or 16F887 ?
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