Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About skyrat

  • Rank
  1. Dont feel so silly now actually ! Ive just found where I got the definition _INTRC_OSC_NOCLK In the include library, there are 2 header files for the PIC16F676.... - p16f676.h - PIC16F676.h I originally got the definition _INTRC_OSC_NOCLK from the header file p16f676.h Obviously the p16f676.h header file is not used. Any idea why there are 2 different header files ???
  2. Its because _INTRC_OSC_NOCLK is not in header file Try: _INTRC_OSC_NOCLKOUT or _INTRC_OSC_CLKOUT Regards Dave <{POST_SNAPBACK}> Cheers Dave ! You were right ! Dont know how I cocked that up ! It may have come from when I opened the wrong header file to start with and copied and pasted it from there ?? Feel a bit silly now
  3. I am trying to use the PIC16F676 with sourceboost, but having problems regarding setting up the config for the PIC. In Sourceboost I have selected the target (in 'Settings -> Target...) as a PIC16F676. I now want to set the PIC16F676 to use its internal RC clock of 4MHz. So I opened the PIC16F676.h file (from C:\Program Files\SourceBoost\include) to see what #defines are used. In the PIC16F676.h file, under the 'Configuration Bits' heading, there is a #define for... #define _INTRC_OSC_NOCLKOUT 0x3FFC So I inserted this line into my code (in addition to other co
  4. I am having a nightmare trying to send a 16-bit variable via the RS232 - the 16-bit variable contains the result of the ADC. I found some Boost C library code from Lika with some functions to send data via RS232. It sent the characters 'Hello World...' out correctly using the statement... serial_printf("Hello world...\r\n"); Then I tried to send a 16-bit variable out using serial_print_dec(variable); but the micro crashed after this point. I thought it could have been because the functions were trying to send a 16-bit variable out using a function only capab
  5. Thanks trossin, Side answer: Ive used 115k baud rate on previous PIC projects. Ive just got it set to 9600 until I get this one up and running ! Back to my problem.... Your example code is fine for the PIC, but Ive no idea how to implement the code for the PC side to recover my data ! The idea was to use hyperterminal or serial comms program. At the end of the day all Im trying to do is send some data out as a decimal value, but there doesnt seem to be an easy way of doing this ? The printf statement in CCS did the job great. Hasnt someone out there already written
  6. I am trying to transmit the 10-bit ADC value measured on the PIC16F877A to the serial port on a PC. I have successfully got the RS232 port working by testing it with the following code... #include <system.h> #define bit_time 104 // 9600 baud at 4MHz (not used but required for compiling) // PIC16F87x defaults for hardware USART support #define TX_PORT 0x07 #define TX_TRIS 0x87 #define TX_BIT 6 #define RX_PORT 0x07 #define RX_TRIS 0x87 #define RX_BIT 7 #define e_SPBRG 0x99 #define e_RCREG 0x1a #define e_TXREG 0x019 #define e_TXSTA 0x98 #define e_RCSTA 0x18 #define e_TXIF_PIR 0x
  7. Thanks Picxie, but arent there some libraries or something that have already written which I can use ? I do not want to go delving into the registers and writting assembly etc. I used to use a compiler called 'CCS' and all that was required to setup the UART was the following line of code... #use rs232(baud=38400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,BRGH1OK) I then used the printf statement to write to the UART, such as... printf ("%02U\r",DATA); // send DATA to RS232 port Is there nothing like this for Sourceboost ? I only want to transmitt data using so
  8. I want to wrtie a simple program to write 8 bit or 16 bit data out to the serial port. I am using Sourceboost C compiler and the PIC16F877A. What code do I need to setup the serial port to run at a standard 9600 baud using a 10MHz crystal ? I cannot find any useful information in the help file. Thanks
  9. My mistake it is working. Just got some of the bits the wrong way round ! Sorry about that !
  10. I am using the PIC16F877A, trying to read the digital inputs on port c and d. But I am not sure if I have writtent the code correctly, because my program doesnt seem to be wokring. Its a simple enough program but I cant get it to work ! I have 4 variables which are used to store the necessary 3 bits. This is done by masking (using the "&" function). The variables are... RING_A : this stores bits 0, 1 & 2 on portc RING_B : this stores bits 3, 4 & 5 on portc RING_C : this stores bits 0, 1 & 2 on portd RING_D : this stores bits 3, 4 & 5 on portd
  11. I am having trouble using an interrupt for timer1. I have stepped through the disassembly listing (in MPLAB) and watched to see what address the porgram jumps to when the interrupt exits. But the address the program jumps to after RETFIE is address 0019 in the program memory. Is this right ? I do not understand what is going on ! Please please help !
  12. Thanks Dave. I am using the PIC16F877A. I tired building the project under SourceBoots IDE, then viewing the call stack in the Code window. If Im looking at it right, then its less then 8 stack deep.
  13. I think Ive found the problem but Im not sure why and how to resolve it. It appears to be like a stack overflow or something like that ? If so, how do I get around this problem ?
  14. Since adding an interrupt my program seems to crash after the interrupt has occured when simulating it in MPLAB. I think the same might be happening when the program is running on the micro. As I am new to source boost (I used to use CCS Compiler) and Im not a very experienced programmer I am unsure if I have written the interrupt correctly. The program crashes as soon as the program exits the interrupt function. Its as if its returning to the wrong address in the program counter ?
  • Create New...