Jump to content

navkan

EstablishedMember
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About navkan

  • Rank
    Newbrie
  1. Pixie Many thanks for your very quick reply. I used "return" because my C reference text "C programming in easy steps" uses it in all the programming examples. Now I note that the author uses the int main function and terminates with a return (0). Anyway, I took your suggestion and removed the return instruction from my program. Guess what! The compiler adds a return instruction to the assembler code. So I will go to your suggestion of adding an endless loop to my program. Thanks again
  2. A beginer programmer, I have written a very simple program to generate a pause using the on-board timer, tmr0. The program compiles succesfully. Using the debugger, the program functions properly except when it executes the main function "return" instruction. A "stack underflow" warning is generated and it restarts from the start. Each time it reaches the end, the warning re-occurs and it re-starts. What am I doing wrong? #include <system.h> #pragma DATA 0x2007, _CPD_OFF & _CP_OFF & _BODEN_OFF & _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _PWRTE_OFF
  3. OK, thanks much for the help. Obviously I have a lot to learn about how PICs operate and how to program them. I'll go away now and do some concentrated study.
  4. Asmallri Many thanks for taking the time to respond from halfway around the world! Ain't the web great!! You raise a couple of newbe questions I don't understand what you mean in your quote above. When the interrupt occurs, I assumed the handler would execute its routine, even if it includes the delay function? If I understand your sample code, you turn on the led in the handler but do further led control in the mainline. You have not used the custom delay function provided in the library. My question is, I asume the delay function is implemented somewhat along the lines of yo
  5. I am very much a beginner PIC C programmer. I wrote the code below for my 16F676 PIC to try a simple one channel a/d conversion. The ISR simply flashes a led a couple of times to signal completion. The program compiles succesfully, however the linker fails. The output is as follows-- "Building... BoostC Optimizing C Compiler Version 6.40 (for PIC16 architecture) http://www.sourceboost.com Copyright© 2004-2006 Pavel Baranov Copyright© 2004-2006 David Hobday Single user Lite License (Unregistered) for 0 node(s) Limitations: PIC12,PIC16 max code size:2048 words, max RAM banks:
  6. Absolutley. thanks for bearing with me Fred
  7. OK, here is my code and the compiler output #include <system.h> #pragma DATA 0x2007, _CPD_OFF & _CP_OFF & _BODEN_OFF & _HS_OSC & _WDT_OFF & _MCLRE_OFF & _PWRTE_OFF #pragma CLOCK_FREQ 20000000 //simple program to demonstrate a/d conversion, measure voltage at port A input void main() { enable_interrupt(GIE); //global interrupt enable enable_interrupt(ADIE); //a/d converter interrupt enable //init a/d converter on RA2 set_bit(ansel,2); //RA2 is analog input set_bit(trisa,2); //RA2 is input mode set_bit(adcon1,2);
  8. Hi, I am quite new to PIC programming and boostC is my first C compiler, please bear with me. First, many thanks to Pavel and Dave for a great product, especially the free version! My first question: Is the only documentation that which is on-line, ie, boostC and C2C help? Is it complete? For example I'm not sure all the available pragma expressions are described Second question: I am writing a very simple program to make a 16f676 PIC do an a/d conversion. The a/d converter interrupt is used in the program. The program is of the form void main() {} void interrupt() {}
×
×
  • Create New...