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 support@ccsinfo.com

Confused about Loading hex files from CCS

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



Joined: 16 Sep 2008
Posts: 26

View user's profile Send private message

Confused about Loading hex files from CCS
PostPosted: Thu Sep 18, 2008 4:58 am     Reply with quote

Hi guys,
I am a novice at programming microcontrollers and just started using CCS compiler. I bought this PIC development board, QL200 from a Chinese company. The board works extremely fine and is supplied along with its own programmer software to burn the hex files. I used the example hex files supplied by the manufacturer to load onto the PIC and see the results on the onboard modules such as LED's, LCd, buzzer..etc. Then, I used the hex file generated by the CCS compiler for the short and simple programs I wrote (for example, turning on LEd's on a port..etc) in CCS. The problem is that I don't see anything happening on the on board modules even after I successfully burn the CCS output hex file on to the PIC. For example, the LED's on a given port just stay the same without change even after programming the PIC. I am concerned whether I am doing it the right way or do I need to use MPLAB in any way. Please help. I really appreciate it. Thank you.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Sep 18, 2008 12:23 pm     Reply with quote

Here is the website for the board.
http://www.pic16.com/en/wzcapi/ql200.htm
The board appears to have a 16F877A with a 4 MHz crystal. It has
LEDs on Port B. Therefore, the following program should blink an LED
on pin B0. There are DIP switches that enable each of the LEDs.
Make sure that the DIP switch for the LED on Pin B0 is "on".
Code:

#include <16F877A.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)

//===============================
void main()
{

while(1)
  {
   output_high(PIN_B0);
   delay_ms(500);
   output_low(PIN_B0);
   delay_ms(500);
  }

}
analog_world



Joined: 16 Sep 2008
Posts: 26

View user's profile Send private message

PostPosted: Thu Sep 18, 2008 8:19 pm     Reply with quote

Hi, Thank you and the code works. I had a question though, how can you use the output_high function without first setting the corresponding PortB pins to be in output mode using the Set_tris function. Infact, initially i set my clock to be 8 MHz in the pic wizard which didn't work out for me. But when I just used the preset 20MHz in the picwizard it works. Can you explain why did this happen?? Thank you.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Sep 18, 2008 8:35 pm     Reply with quote

Quote:

In fact, initially i set my clock to be 8 MHz in the pic wizard which didn't
work out for me. But when I just used the preset 20MHz in the pic wizard
it works.

The photograph of the board shows a 4 MHz crystal. You need to look
at your board, to what crystal it really has.

Quote:
how can you use the output_high function without first setting the
corresponding PortB pins to be in output mode using the Set_tris function

The CCS compiler automatically sets the correct TRIS, provided that you
use the CCS i/o functions. This is the default mode of the compiler.
You don't have to specify it. This feature allows you to write code more
easily than with other compilers.
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