microchip

What is the best c complier for the Pic18 micro

We are starting a new project based a microchip PIC18F252. What is the best 'c' compiler to use? ...

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 ...

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...

Can I reset Microchip's TCP/IP stack without reseting the board?

I'm working with Microchip's free TCP/IP (version 4.55) stack on an 8-bit micro-controller. I'm trying to reset the stack without doing a full board reset with asm("RESET"). Any ideas on how to restart this Stack. UPDATE I reset the stack with the following steps Toggle the reset pin to on the Microchip Ethernet chip Call StackInit...

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...

Keeping time using timer interrupts an embedded microcontroller

Hello, This question is about programming small microcontrollers without an OS. In particular, I'm interested in PICs at the moment, but the question is general. I've seen several times the following pattern for keeping time: Timer interrupt code (say the timer fires every second): ... if (sec_counter > 0) sec_counter--; ... Main...

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...

C18 compiler typedef enum data size

I'm trying to port code over to compile using Microchip's C18 compiler for a PIC microcontroller. The code includes enums with large values assigned (>8-bit). They are not working properly, indicating that, for example, 0x02 is the same as 0x2002. How can I force the enumerated values to be referenced as 16-bit values? ...

Code that causes physical effects in hardware?

A couple of years ago, I remember reading about an academic project that executed a specific sequence of instructions whose effect was to cause the targeted processor to catastrophically overheat and fail, by exceeding the tolerance limits of the processor's design. It was interesting because it was the only example I've ever seen of a p...

convert ASM to C (not reverse engineer)

I googled and I see a suprising amount of flippant responses basically laughing at the asker for asking such a question. Microchip provides some source code for free (I don't want to post it here in case that's a no-no. Basically, google AN937, click the first link and there's a link for "source code" and its a zipped file). Its in AS...

Accessing functions in an ASM file from a c++ program?

Banging my head today ;) Over here I asked about translating an ASM file to C, and from the responses it looked like there was no reasonable way to do it. Fine. So one of the responses suggested I just make use of the functions as-is and be done with it. Sounds good. But how? Holy crap I've tried everything I can think of! I'm usi...

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...

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...

Macro indicating I/O pins used

I'm writing firmware for a PIC32MX, using HiTech PICC32. One of the problems I want to avoid is that since most of the pins have multiple names (eg. AN0 = RB0 = CN2 = PGED1), I or someone else might accidentally use RB0 without realising that AN0 is already used. (This can actually be catastrophic, since incorrectly configuring an analog...

viewing a structure in MPLAB watch window

I want to view a structure in the MPLAB watch window, but when I select it from the "Add symbol" drop down menu I get, "Unsupported Structure". I was hoping to look for an answer on microchip's forums, but the site seems to be down, so I thought I would test this community out. Why is the structure "unsupported"? How can I get it sup...

Display previously received UART values

This should be easy to answer to anyone familiar with C. I want to display the previous values of a variable (receive register of a UART (RS-232) on a microcontroller) on an LCD. This is my current implementation and it works ok. But I'd like to know if there is a way to spend less time in my interrupt routine. Currently, the peripheral ...

Circular buffer pointer irregularities

This is a follow up on this question: Display previously received UART values. After implementing a circular buffer on the microcontroller, it seems that there is a problem with the pointers. Sent on RS-232: ADE1234 Received (buffer = 8): E24AE2 / E2AE24 (Flips between the two) Received (buffer = 16): D234E1 (A is skipped, since it i...

Data types in .Net versus data types in Motorola PLC ?

Hi, Can anyone help for getting the list of all the datatypes of motorola PLC. Thanks, Khan ...

PIC 16F684 Microcontroller Interupt Handling

I just finished up my Microprocessors class in college just a few weeks ago, there we programmed in assembly only. We learned a fair amount (IMHO) about interrupts. Here is my question: I am programming in C using the HiTech Compiler for the 16F684, in the datasheet section discussing the interrupts (PIC 16F684 Datasheet Section 12.4) ...