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

How to generate the C-code to ASM

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



Joined: 15 Oct 2006
Posts: 18
Location: Taiwan

View user's profile Send private message MSN Messenger

How to generate the C-code to ASM
PostPosted: Tue Oct 24, 2006 4:49 am     Reply with quote

Dear all

I am a new comer for CCS. I have so many problems. I try PIC12F683 for my new practice. But I generate the basic function just to outptu a GPIO(PIN_A0) to High then low. I found the code is no work. I find a problem from the .LST file.


The c-code output_tris_a(0x38), I just set the A0~A2 for output and A3~A5 as the input. And the LST file show

.................... set_tris_a(0x38) ;
0037: MOVLW 38
0038: MOVWF 05

Register 05 should be the Port A and not TRIS.

I have some upset for the CCS. So I try to generate the basic functions I want from C-code then port it by ASM.

Please teach me how to generate the ASM from C_code.

Best Regards

Goodwin
Goodwinchang



Joined: 15 Oct 2006
Posts: 18
Location: Taiwan

View user's profile Send private message MSN Messenger

PostPosted: Tue Oct 24, 2006 4:53 am     Reply with quote

I find a problem for my problem that is CCS generate the correct code and when I open the C-code and compiler again in MPLAB using CCS compiler. And the problem I have happens.

Is MPLAB issue? or the compatibility issue for CCS and MPLAB>

Best Regards

Goodwin
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Oct 24, 2006 1:02 pm     Reply with quote

Post your small test program. Also post your compiler version.
Goodwinchang



Joined: 15 Oct 2006
Posts: 18
Location: Taiwan

View user's profile Send private message MSN Messenger

PostPosted: Wed Oct 25, 2006 7:28 am     Reply with quote

sync.c as following

#include "F:\Download\Working\CCS\1025200603\sync.h"


void main()
{

setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC);
setup_vref(FALSE);
setup_oscillator(OSC_8MHZ);

// TODO: USER CODE!!

}

and sync.h as following
#include <12F683.h>
#device adc=8

#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC //Internal RC Osc
#FUSES NOCPD //No EE protection
#FUSES NOPROTECT //Code not protected from reading
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPUT //No Power Up Timer
#FUSES BROWNOUT //Reset when brownout detected
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled

#use delay(clock=8000000)
#use rs232(baud=9600,parity=N,xmit=PIN_A3,rcv=PIN_A2,bits=8,stream=RS232)


I just use this test code to try setting the internal OSC as 8MHz and output the 2MHz at A4.
And actaully it doesn't work.

Who can tell me what happens or what I do the wrong thing.
Ttelmah
Guest







PostPosted: Wed Oct 25, 2006 8:41 am     Reply with quote

Add one line to the end of the main:

while (TRUE) ;

Without this, the oscillator will wake up and run for just a few hundred cycles, then the code will drop off the end of the 'main', go to sleep, and the oscillator will stop. Unless you happend to catch the short burst of operation, it'll appear not to work.
Also, PCM programmer asked 'what compiler version'. This is vital data for answering this type of question.

Best Wishes
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Wed Oct 25, 2006 9:41 am     Reply with quote

Is the NOLVP fuse a gotcha with this part?
Ttelmah
Guest







PostPosted: Wed Oct 25, 2006 10:27 am     Reply with quote

No.
A damn good idea, but not on the 8 pin parts. They don't have this fuse.

Best Wishes
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