Jump to content

JB99

EstablishedMember
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

0 Neutral

About JB99

  • Rank
    Newbrie
  • Birthday 12/14/1967

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Gender
    Male
  1. #pragma config LVP = ON This was my mistake, I had this turned on in my config. Someone on the PIC forums noticed
  2. I want to use an 18K14K50 in a project but I can't get it to work at all. In an attempt to get *anything* to work I've removed all the hardware and software and failed to even get the basics to work now... I've connected a PICKIT2 programmer to it to program it and a single LED and resister to pin 16 which is RC0. No other hardware is attached. I want to configure it to use the internal oscillator to to simplify things until I get it to work at all. And then written the program like this - I can think of two things that might be wrong, either my config settings which are suppose to set it to use the internal oscillator, or I'm failing to set up some essential control to use digital outputs. Any advice would be welcome #include <system.h> #pragma config CPUDIV = NOCLKDIV #pragma config USBDIV = OFF #pragma config FOSC = IRC #pragma config PLLEN = OFF #pragma config PCLKEN = ON #pragma config FCMEN = OFF #pragma config IESO = OFF #pragma config PWRTEN = ON #pragma config BOREN = ON #pragma config BORV = 27 #pragma config WDTEN = OFF #pragma config WDTPS = 1 #pragma config MCLRE = OFF #pragma config HFOFST = OFF #pragma config STVREN = ON #pragma config LVP = ON #pragma config BBSIZ = OFF #pragma config XINST = OFF #pragma config CP0 = OFF #pragma config CP1 = OFF #pragma config CPB = OFF #pragma config CPD = OFF #pragma config WRT0 = OFF #pragma config WRT1 = OFF #pragma config WRTB = OFF #pragma config WRTD = OFF #pragma config EBTR0 = OFF #pragma config EBTR1 = OFF #pragma config EBTRB = OFF #pragma config WDTEN = OFF /* Internal oscillator default frequency ( I think...) */ #pragma CLOCK_FREQ 1000000 /* Disable all the analogue parts so that digital output works */ inline void pic_set_digital() { ansel = 0; anselh = 0; } void main() { pic_set_digital(); trisc = 0x00; while(1) { portc = 0xFF; delay_ms(250); portc = 0x00; delay_ms(250); } }
  3. Yes, that's what I'm using now and it seems to work fine. Pity it's not sourceboost compilable though, I need to build a slightly different version at some point and have no way to compile it at the moment. I'm guessing that porting it would be a seriously large amount of effort...
  4. Ok thanks, good news for me that it's safe anyway. Can I add a feature request for a way to disable the warning on a function by function basis (I wouldn't want to supress the message for unexpected misuses). It would be handy if you could put a #pragma before a function with two options 1) Disable the warning for calling that function 2) "Clone" the function for each thread it is called from. Low priority but would be a handy enhancement.
  5. This isn't *just* about delay_us, that's just meant as an example. I get this warning when i compile my program :- Serious Warning: Possible sw stack corruption, function 'delay_us' called by more than one asynchronous thread (main/Task, interrupt, interrupt low) I understand that functions are not reentrant using sourceboost c. In this case though I know that the function will only be called during initialisation from the main program, and once interrupts are enabled will never be called except from the interrupt handler. Can I confirm that this is safe to do? (Even if there is a risk that I'll forget and call it from the main program too) Is there any way to supress the message. I understand it's a valid warning but once I've understood that and made sure that my code will not call it at the same time from two threads it's just clutter that might make me miss other warnings.
  6. Thank you, I've looked at several bootloaders since I posted this and got my sourceboost code to work perfectly with them
  7. Well the data sheet says that the internal oscillator is accurate to 1% so you are already getting better than that. If you need more accurate timing you're going to have to use an external crystal. Figure 5.3 in http://ww1.microchip.com/downloads/en/DeviceDoc/41364D.pdf shows you how.
  8. Well I got this mostly working. I can receive data from the PC to the PIC and it all works. But the data received is truncated to the size of the EP0 buffer. I'm using the usb_handle_class_ctrl_write_callback method. It's working well enough for my application anyway. Is there somewhere better I can ask questions about this USB library as it's not really a compiler question.
  9. I'm trying to use the picpack usb library to implement usb on my 18f2550 board. I want to use a generic HID interface and need to be able to send 40 byte long messages to the board. At this point I don't need to receive anything. There isn't much documentation for this library though past the point of configuring it so I'm wondering if anyone else has got such a thing working? The hardest part seems to be setting up the usb configuration, I'm wondering if anyone else has a configuration for a similar project they would be willing to share?
  10. I'm considering using this usb bootloader on my 18F2550 for my next project http://www.diolan.com/pic/bootloader.html But before I start my question is will my sourceboost c work with it? It looks like I just have to add an -rb xxxx option to the linker to make it locate the compiled code after the bootloader and all will be happy, but is that correct and is there anything else I need to be aware of? Also, does anyone have any experience of that bootloader, or of any others? I'd like to be able to update my code frequently during development over USB as my design of board makes using my pickit2 awkward (but possible) so a bootloader to allow updates over USB seems ideal
  11. Ah, yes that's it. I even avoided that problem in my assembly language version and completely forgot about it in the C version. It works properly now. Thank you and sorry for such a trivial problem!
  12. Hello all, I'm evaluating the C compiler to see if it will be suitable for a small project I want to do so first of all thank you producing it Now my problem, I have a pickit2 and the low pin count board that comes with it. It has a 16F690 chip and LEDs on portc bits 0-3 and a switch on porta bit 3 As a simple test I've made the following program. All if is supposed to do is to flash one LED and have the other reflect the state of the input bit. However it only displays the state of the input bit. If I swap around the two lines that set the port bits then it only flashes. It's as if the first assignment to a bit of port C doesn't work. The point is that both the LED setting lines work individually but when I have them both one doesn't do anything. The board is working fine as the assembly language version works ok. Basically this is my first C program for this board and I'm wondering if I missed something somewhere... #include <system.h> #pragma DATA _CONFIG, _FCMEN_OFF & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_OFF & _PWRTE_OFF & _WDT_OFF & _INTOSCIO #pragma CLOCK_FREQ 4000000 int main() { trisc = 0x00; trisa = 0x08; char d = 0; while(1) { portc.0 = d; /* Set first LED to flash */ portc.1 = porta.3; /* Second LED on button state */ d = !d; delay_ms(200); } }
×
×
  • Create New...