|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
2nd printf is never run in simulator? |
Posted: Wed Sep 22, 2004 7:12 pm |
|
|
why does my program stop before the 2nd printf in the simulator?
reply to josh_wolf@yahoo.com
Code: | #include "C:\Documents and Settings\scott\Desktop\test.h"
#include <stdio.h>
#int_AD
AD_isr()
{
}
int1 i = 0;
void main()
{
port_b_pullups(TRUE);
setup_adc_ports(RA0_ANALOG);
setup_adc(ADC_CLOCK_DIV_32);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_AD);
enable_interrupts(global);
while(1)
{
i=1;
delay_ms(10);
output_high(PIN_B7);
delay_ms(1000);
output_low(PIN_B7);
delay_ms(10);
printf("hi");
printf("BYE");
printf("2 BYE");
}
}
|
|
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
This needs to be addressed to Microchip |
Posted: Wed Sep 22, 2004 8:10 pm |
|
|
Josh,
You need to address all these questions about problems in MPLAB to the Microchip forum, not here..
CCS has on more then one occasion made it clear that they make no guarantees about supporting CCS C in MPLAB. Any interface CCS provides is a courtesy and CCS cannot be expected to provide support for a Microchip product especially a free one. They sell their own IDE and debugger that works very well with the CCS compiler. |
|
|
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Wed Sep 22, 2004 8:23 pm |
|
|
dyeatman is correct, you'll probably get a much better response in Microchip forums.
But as a general rule of thumb, never step into/over delay and RS232 statements. Either set a breakpoint on the next line after them and run the code, or go to the next line and right-click, then choose 'Run to here'. |
|
|
Guest
|
I am asking about that because ccs does not have a simulator |
Posted: Wed Sep 22, 2004 8:52 pm |
|
|
I am asking about that because ccs does not have a simulator. I do not have a ICD |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Sep 22, 2004 10:17 pm |
|
|
Is that the whole program? No device? No #use rs232? No clock speed? Fuses? Look at the CCS example files to see how to setup a C file. |
|
|
Guest
|
Ok The device information I used was created by the wizard |
Posted: Fri Sep 24, 2004 9:34 am |
|
|
Ok The device information I used was created by the wizard. I will post it when I get home. I know the wizard does not put in NOWDT when you turn the box off so I was wondering if it left somehting nessisary out. |
|
|
Guest
|
here is what I had and it wont step through the printf |
Posted: Fri Sep 24, 2004 9:41 pm |
|
|
here is what I had and it wont step through the printf
Code: | #define START PIN_B0
#define SIN PIN_B1
#define LOAD PIN_B2
#define RESET PIN_B3
#define XCK PIN_B4
#define READ PIN_B5
const char maskData = 0b10000000; //mask out the last bit to be shifted in data
const char maskAdr = 0b00000100; //mask out the last bit to be shifted in adr
void setDefalts(void)
{
//SET DEFALTS
output_low(START); //start=low
output_low(SIN); //sin.data=low
output_low(LOAD); //load=low
output_high(RESET); //reset=high
output_low(XCK); //Xck=low
}
void resetCam(void)
{
output_low(RESET); //pull reset low
output_high(XCK); //pull Xck high
output_high(RESET); //pull reset high
output_low(XCK); //pull Xck low
}
void resetCamDelay(void)//same as reset camera except delays so you can see it.
{
delay_ms(1000);
output_low(RESET); //pull reset low
delay_ms(1000);
output_high(XCK); //pull Xck high
delay_ms(1000);
output_high(RESET); //pull reset high
delay_ms(1000);
output_low(XCK); //pull Xck low
delay_ms(1000);
}
void loadReg(char reg)
{
output_bit(SIN,reg & maskAdr); //mask first bit of the adress and output
output_high(XCK); //clock data in
output_low(XCK);
reg=reg<<1; //shift left
output_bit(SIN,reg & maskAdr); //mask first bit of the adress and output
output_high(XCK); //clock data in
output_low(XCK);
reg=reg<<1; //shift left
output_bit(SIN,reg & maskAdr); //mask first bit of the adress and output
output_high(XCK); //clock data in
output_low(XCK);
}
void loadData(char data)
{
output_bit(SIN,data & maskData); //mask first bit of the data and output
output_high(XCK); //clock data in
output_low(XCK);
data=data<<1; //shift left
output_bit(SIN,data & maskData); //output 2nd bit
output_high(XCK); //clock data in
output_low(XCK);
data=data<<1; //shift left
output_bit(SIN,data & maskData); //output 3rd bit
output_high(XCK); //clock data in
output_low(XCK);
data=data<<1; //shift left
output_bit(SIN,data & maskData); //output fourth bit
output_high(XCK); //clock data in
output_low(XCK);
data=data<<1; //shift left
output_bit(SIN,data & maskData); //output fifth bit
output_high(XCK); //clock data in
output_low(XCK);
data=data<<1; //shift left
output_bit(SIN,data & maskData); //output 6th bit
output_high(XCK); //clock data in
output_low(XCK);
data=data<<1; //shift left
output_bit(SIN,data & maskData); //output 7th bit
output_high(XCK); //clock data in
output_low(XCK);
data=data<<1; //shift left
output_bit(SIN,data & maskData); //output 8th bit
output_high(XCK); //clock data in
output_high(LOAD); //load register
output_low(XCK);
output_low(LOAD);
}
void startCam(void)
{//START SEQUENCE
output_high(START); //pull start up
output_high(XCK); //pull clock up
output_low(START); //pull start low
output_low(XCK); //pull clock low
}
|
Code: | #include <16F877A.h>
#device adc=8
#use delay(clock=20000000)
#fuses HS, NOWDT, NOLVP, BROWNOUT//never trust the wizard gizmo
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7)
#USE DYNAMIC_MEMORY//this could gain memory back after the function is over.
#include "C:\WINDOWS\Desktop\camera\GBCamera.h"
#ZERO_RAM
#int_AD
AD_isr()
{
}
void main()
{
int i= 1;
port_b_pullups(TRUE);
setup_adc_ports(RA0_ANALOG);
setup_adc(ADC_CLOCK_DIV_32);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
enable_interrupts(INT_AD);
enable_interrupts(global);
while(TRUE)
{
setDefalts();
resetCam();
loadReg(0);
loadData(128);
loadReg(1);
loadData(6);
loadReg(2);
loadData(1);
loadReg(3);
loadData(85);
loadReg(4);
loadData(1);
loadReg(5);
loadData(0);
loadReg(6);
loadData(0);
loadReg(7);
loadData(33);
startCam();
printf("lets hope this works");
while(0==input(READ)); //ENDLESS LOUP TILL READ GOES HIGH
}//END OF ENDLESS LOOP
}//END OF MAIN
|
|
|
|
|
|
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
|