pic

Resetting a Pic18 from C

What is the best way to reset a Pic18 using C code With the HiTech Pic18 C compiler Edit: I am currenlty using void reset() { #asm reset #endasm } but there must be a better way ...

Writing apps in C for microcontrollers

What resources do you know dedicated to software development in C for PIC microcontrollers? I would like to see some kind of framework that handles both IO (buttons for input and LCD for output) and application logic. You can think of it as a VERY simple OS. I understand that PIC's memory can be small for such frameworks so I think it c...

How can I increase the size of a memory block in MPLAB?

The Microchip PIC MPLAB (MCC18) compiler segments its memory into 256 chunks ( 0x100 ). How can I create an array larger than 256 bytes? char buffer[256]; Just to get to 256 I needed to make a seperate segment with a #pragma #pragma udata segment_name char buffer[256]; #pragma udata So I can either force MCC18 to let allocate a la...

F/OSS for the PIC24?

I'm learning embedded programming with the PIC24, and I'm looking for something "real-world" to dig into to help me learn. Are there any free software projects that might be targeting to the PIC? Anything that I could help port, or a niche I could try to fill? ...

Microchip Linker problem

hello guys,when i was trying to build my project in MPLAB,i got this Build error message.. Clean: Deleting intermediary and output files. Clean: Deleted file "M:\12 CCP PWM\12 CCP PWM.o". Clean: Done. Executing: "C:\MCC18\bin\mcc18.exe" -p=18F46K20 "12 CCP PWM.c" -fo="12 CCP PWM.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- MPLAB C18 v3.20...

Getting Started With Programming PICs (or similar products)

How do I get started with programming PICs (or similar products)? Preferably in C. What are some good beginner kits, tutorials, books, etc.? Maybe some little robotic project ideas. ...

Bank switching in PIC assembler

I'm getting confused by bank switching in PIC assembler... This works for putting a 'Q' on the usart: bsf PORTB,1 ;Set Transmit DIR (PORTB (0x6) not mirrored in other banks) movlw 'Q' ;'Q' to work reg movwf TXREG ;work reg to TXREG (TXREG (0x19) not mirrored in other banks) clrwdt ;Clear watchdog b...

PIC I2C slave ack on data

Hi! I am looking into the I2C protocol for PIC16F88X. What I would like to do, is to enable an I2C slave to either ACK or NACK depending on the data received on the I2C. The PIC can ACK or NACK on the I2C address sent on the line, but from what I've read it will always ACK on the subsequent received bytes. Is that correct? In the foll...

How to call Microchip PIC USB DLL with Delphi 2009

Not a question, just a statement to help anyone else who might spend hours getting the Microchip PIC USB DLL to work properly with Unicode. It expects several strings, and although these are simple PAnsiChar, getting the right combination of DLL call convention took me ages. There are a lot of people on the 'net using Delphi (non-Unicod...

PIC16 C compiler

Hi all! I am looking for a good C compiler for the PIC 16 family, working on Windows. A couple of colleagues use bknudc but some seem to dislike it. Apparently you cannot use the linker efficiently, and it turns out that the best is to set all code in include files. SDCC seems nice, but looks like it is still in beta, and not easy to ...

Are any MP3 encoder libraries PIC microcontroller compatible?

I know that are many MP3 encoder libraries, but any of them could work on a PIC microcontroller? ...

Convert Hex to Decimal when no datatype can hold the full number

Ok, so I am working with a PIC microprocessor, in C. It's a 16F, so it can't hold integers larger than 32bits (unsigned int32 is the largest datasize available) From a reader, I receive a 5 byte ID code. To transmit it, I have to encoded to BCD, digit by digit. I can't sprint it to a string, as it is larger that the data size, and can't...

Convert Decimal to Hex when no datatype can hold the full number

This is an almost exact duplicate of my own question a few weeks ago. http://stackoverflow.com/questions/1143302/convert-hex-to-decimal-when-no-datatype-can-hold-the-full-number This time, it is the reverse. I have the number (in a handy null terminated string) and I need the bytes that make this number. However, I am working in a 32 b...

What microcontroller (and other components) would I need to create a timer device?

As a hobby project to keep myself out of trouble, I'd like to build a little programmer timer device. It will basically accept a program which is a list of times and then count down from each time. I'd like to use a C or Java micro controller. I have used BASIC in the past to make a little autonomous robot, so this time around I'd like ...

Help with translating this assembly into c

Hi. My compiler won't work with an assembly file I have and my other compiler that will won't work with the c files I have. I don't understand assembly. I need to move this over but I'm not getting anywhere fast. Is there someone out there that can help? I can't believe there isn't a translator available. Here is the beginning of the...

How to concatenate vars in c programmed pic?

Hi guys, I programming a 16f84a pic in hitech C to drive a hd44780 lcd. So far I've got the lcd initialized and can write individual characters and strings to the lcd. Now I need to do something like this: var = 250; lcd_write_string("MyVar has value: " + var); so the lcd should show "MyVar has value: 250" First of all how should I con...

Regarding interrupt based communication

We have a simple architecture : Main chip (arm9 based) PIC controller The PIC communicates to ARM via an interrupt based I2C communication protocol for transfer of data. Inside the interrupt we signal a task which reads the data from the I2C layer (bus). In case the data is limited we usually won't have much problem to read the data...

How to specify adress ranges for PIC code?

I want to use Claudiu Chiculitas tiny bootloader for PIC16 (i have modyfied it to suit my chip) but since that bootloader does not move code to prevent overwriting the bootloader, I must somehow manually see to that the bootloader is not overwritten. I have tried to use the --rom option like this: --rom=default,-0-4,-3f00-3fff What I ...

Whats the best resource to learn Assembly language for PIC microcontroller's

I'm going to start working on a project where I need to have a decent understanding of Assembly language for the PIC microcontroller's. I'm intimately familiar with C/C++, so I know how to code for the most part, and I have done many projects for the PIC already so I understand the architecture, but have done all my programming for it i...

How can I make MPLAB import a HEX file with comments or import a HEX file specified on a commandline?

I'm working with the CCS c compiler which produces its object files in the Intel 32 bit HEX format, aka INHX32. This compiler has a directive which causes it to put comments in these files. The comment lines are at the beginning of the file, and begin with a semicolon, like so: ; This is a comment :020000040000FA :1000000007EF33F0000C...