CAN-settings for PIC18F4585

Started by Mich in comp.arch.embedded15 years ago 2 replies

Hi, I 'm programming a PIC18F4585 with MPLAB. I want to use the CAN option and I have made the basic C and H files with the aplication maestro...

Hi, I 'm programming a PIC18F4585 with MPLAB. I want to use the CAN option and I have made the basic C and H files with the aplication maestro of Microchip. I 'm working on a clock frequency of 40MHz. These are the settings I have calculated for a baudrate of 125k. #define BAUD_RATE_PRESC 16 #define SJW_TIME 1 #define SAMPLES 1 #define PROP_TIME 2 #define PH_SEG_1 4 #define PH_SEG...


How to write unit tests for embedded C code?

Started by smo59 in comp.arch.embedded19 years ago 7 replies

I have inherited a project with xxxx number of lines of C code to be assembled and executed on a PIC microcontroller. As you might expect, once...

I have inherited a project with xxxx number of lines of C code to be assembled and executed on a PIC microcontroller. As you might expect, once I did this nothing happened and I am left swinging in the wind about what went wrong. Although I might be able to fix this using the MPLAB ICD debugger, I am convinced that writing unit tests for the code will highlight any bug(s) in the code and i...


MCC18 / PIC C18 - how to write to internal EEPROM?

Started by Royston Vasey in comp.arch.embedded13 years ago 3 replies

I'm new to C and am trying to write a byte to the internal EEPROM in a 18F45k20. I've done this in the past using assembly but now I'm...

I'm new to C and am trying to write a byte to the internal EEPROM in a 18F45k20. I've done this in the past using assembly but now I'm working in C I figure there should be a function for doing this. I've found reference to write_b_eep and read_b_eep on the net but cannot see any reference to these in the MPLAB C18 Compiler Libraries documentation. What is the way to approach this? ...


Strange behavior of RA4 and RA5 on PIC18F242

Started by Paul E. Schoen in comp.arch.embedded16 years ago 6 replies

Hello, I am new to this NG, but my question seemed more appropriate here than on SED. I'm using a PIC18F242 for an SCR controller, and...

Hello, I am new to this NG, but my question seemed more appropriate here than on SED. I'm using a PIC18F242 for an SCR controller, and programming it in assembly with MPLAB 7.30. I am using RA4 as an Output On indicator, driving an LED and an optoisolator through a series resistor to +5VDC. I use RA5 to drive a status LED, low for green and high for red. Everything worked fine whe...


simulation tutorial? Asynchronous interrupts?

Started by mike in comp.arch.embedded8 years ago 5 replies

I'm writing simple programs for a PIC 16F877A. Attempting to simulate with MPLAB. Linear code...no problem. But I've never written a...

I'm writing simple programs for a PIC 16F877A. Attempting to simulate with MPLAB. Linear code...no problem. But I've never written a program that didn't have multiple asynchronous interrupt inputs and timers. The MPSIM seems to fall apart in that instance. Yes, there are ways to simulate inputs, but the asynchronous nature is where all the problems happen. State another way, no pro...


PIC 18F4455 simple project help

Started by CMOS in comp.arch.embedded15 years ago 8 replies

hi, i've started playing with 18F4455 device. im using MPLAB with c18 compiler student version. as a start what am trying to do is to light an...

hi, i've started playing with 18F4455 device. im using MPLAB with c18 compiler student version. as a start what am trying to do is to light an LED connected to pin 6 (RA4). here is the code. #include #pragma config WDT = OFF void main() { ADCON1 = 0x0F; CMCON = 0x07; TRISA = 0xCF; LATAbits.LATA4 = 1; while(1); } how ever the LED in the target circuit does not


Detailed memory usage by module on a PIC18

Started by Nickolai Leschov in comp.arch.embedded15 years ago 8 replies

Hello, I have a legacy project for PIC18F452 that compiles with HI-TECH Software C Compiler, using MPLAB IDE. The device's flash program...

Hello, I have a legacy project for PIC18F452 that compiles with HI-TECH Software C Compiler, using MPLAB IDE. The device's flash program memory is nearly full and I'm curious to see what occupies most of this space. How can I see memory footprint of compiled program, by modules? The project consists of 19 'C' files; if the compiler told me how much memory each one uses, that would be...


Programming my PIC chip in Linux

Started by in comp.arch.embedded15 years ago 1 reply

I'm running Ubuntu Linux. I have a C project that I want to compile and upload to my PIC chip (the PIC16F684 to be exact). I've already...

I'm running Ubuntu Linux. I have a C project that I want to compile and upload to my PIC chip (the PIC16F684 to be exact). I've already gotten the PIC Lite C complier from htsoft.com, but I need an application for uploading the machine code to the chip. Windows users use a thing called MPLAB, but I can't get this for Linux. Can anyone please suggest a Linux alternative? I don't nee...


PIC24 newbie question "Unused Fragments" ?

Started by Mike in comp.arch.embedded10 years ago

Hi, I am new to the PIC24 series and on compiling an existing program for the PIC 24FJ256B106 using the CCS compiler under MPLAB-X I notice...

Hi, I am new to the PIC24 series and on compiling an existing program for the PIC 24FJ256B106 using the CCS compiler under MPLAB-X I notice that the the .STA file has the statement "ROM used: 12464 (7%)" followed by "66048 (38%) including unused fragments". I did a search on the CCS forums without much luck, can anyone give me the skinny on what causes these unused fragments and how to mi...


Really confused by my debugger.

Started by Brendan Gillatt in comp.arch.embedded15 years ago 4 replies

I recently purchased a clone Microchip PIC debugger from some Chinese importer http://www.virtualvillage.co.uk/Items/006401-001? (bad...

I recently purchased a clone Microchip PIC debugger from some Chinese importer http://www.virtualvillage.co.uk/Items/006401-001? (bad idea probably, I know). I set it all up, it programs perfectly and does a POST fine. The problem is with debugging. I hit the 'program' button on MPLAB, the PIC is programmed fine but I get an 'ICD0083' error (cannot enter the debug mode on the chip). I'v...


MPLAB_6v5: project working directory - can't set to "sticky"

Started by robi...@tesco.net in comp.arch.embedded18 years ago 2 replies

How do you setup the IDE in MPLAB_6V5 so that File/Open points to your working directory and not to "myDocuments" when you first open your...

How do you setup the IDE in MPLAB_6V5 so that File/Open points to your working directory and not to "myDocuments" when you first open your project. (i.e. the "sticky" option in MPLAB 5V7) TIA Robin


C18 calculation question - novice...

Started by Dennis in comp.arch.embedded11 years ago 13 replies

I'm trying to interface a SHT21 humidity sensor to a PIC (and learning C18 along the way, MPLAB, C18, PIC18LF44K22). A 16 bit serial value,...

I'm trying to interface a SHT21 humidity sensor to a PIC (and learning C18 along the way, MPLAB, C18, PIC18LF44K22). A 16 bit serial value, S_RH, is read from the sensor. To convert this value into relative humidity, RH, it needs to be inserted into an equation. RH = (125 x S_RH)/ 2^16 - 6 The data sheet gives a test value of S_RH = 25424 giving RH = 42.5% which works nicely. ...


PIC 18 Series - HS+PLL Enabled Clock Mode

Started by John Lucas in comp.arch.embedded18 years ago 2 replies

Hi I am using a PIC18F452 with an external 8MHz crystal. I am trying to enable the HS+PLL Enabled mode, the device programs okay, and...

Hi I am using a PIC18F452 with an external 8MHz crystal. I am trying to enable the HS+PLL Enabled mode, the device programs okay, and when read back, the configuration values are correct, however, in use, the device is still running at 8MHz. I am using MPLAB 6.62 with an ICDII. Can anyone suggest a reason why the PLL may not be working. Thanks John Lucas


What am I doing wrong?

Started by Julian Morrison in comp.arch.embedded17 years ago 23 replies

--nextPart2912043.rat7JAi7FX Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit I'm trying to code a very simple...

--nextPart2912043.rat7JAi7FX Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit I'm trying to code a very simple LED flasher as a starter app, and I can't get the damn thing to work. (This is on PIC16F627 and simulated on MPLAB.) The timer1 rollover never fires. Code follows as attachment. Can someone tell me what I'm doing wrong? --nextPart2912043.rat7JAi7FX ...


writing to Program memory in PIC controllers

Started by aroravaibhav87 in comp.arch.embedded15 years ago 13 replies

Hi! With reference to the...

Hi! With reference to the doc http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=38003&start=all&postdays=0&pos torder=asc ,it's possible to write directly into the program memory section in AVR controller ,I would like to know whether it is possible to follow a similar kind of procedure for PIC controllers as well. (I use an MPLAB v7 for programming the PICs ) Thanks in


Menus on LCD for embedded systems

Started by murp...@yahoo.com in comp.arch.embedded15 years ago 13 replies

Hi I want to have menus (with sub menus and so on) on a LCD (graphics LCD and I can have about 4 lines on it) of an embedded system. I am...

Hi I want to have menus (with sub menus and so on) on a LCD (graphics LCD and I can have about 4 lines on it) of an embedded system. I am programming in C (MPLAB C18 does not support C++). The system has three keys, UP, DOWN and ENTER. I have searched a lot on the internet for data structures and methods for such applications. I have found that lot of people say pointer to functions can...


IC2 problem with PIC16F877#

Started by John Smith in comp.arch.embedded14 years ago 6 replies

Hi, Our laboratory recently purchased a MPLAB ICD2 programmer. Everytime I try to program my PIC etheir by using the "Debugger" or the...

Hi, Our laboratory recently purchased a MPLAB ICD2 programmer. Everytime I try to program my PIC etheir by using the "Debugger" or the "Programmer" mode I receive this error: ICD0161: Verify failed (MemType = Program, Address = 0x0, Expected Val = 0x283A, Val Read = 0x0) I looked the forum and people seem to think that it is related to the vdd voltage or maybe that the ICD 2...


dsPIC problem

Started by Syd Rumpo in comp.arch.embedded11 years ago 12 replies

Hello I have an odd problem with some dsPIC code. I'm using MPLAB and a dsPIC Starter Kit 1. I have some C code calling an assembler...

Hello I have an odd problem with some dsPIC code. I'm using MPLAB and a dsPIC Starter Kit 1. I have some C code calling an assembler routine - in fact the Microchip FFT stuff. It doesn't work and causes the processor to hang or reset or go off on a jaunt - not sure which. I have three LEDs which the C code turns on if/when the assembler routine returns. If I put the appropriat...


pic16f877a uart c code problm

Started by sivaramakrishna in comp.arch.embedded14 years ago 5 replies

Hai to all, Iam trying to communicate from pic 16f877a to the pc's hyperterminal at 9600 baud rate. Iam posting my code for this. Iam able...

Hai to all, Iam trying to communicate from pic 16f877a to the pc's hyperterminal at 9600 baud rate. Iam posting my code for this. Iam able to simulate with mplab but I could not implement with hardware. I checked for max232, rs232. They seem to be working perfect. But iam not getting the data through hyperterminal comm port. My crystal oscillator is 8mhz. /* uart serial communicati...


dsPIC software Interrupt generation problem

Started by nandlal in comp.arch.embedded15 years ago

Hi, I have been using dspic30f4011, for the external interrupt if the Pin is defined as input. So how the user can generate interrupt...

Hi, I have been using dspic30f4011, for the external interrupt if the Pin is defined as input. So how the user can generate interrupt by manually changing the port pin status in MPLAB SIM ? Because once its defined as input user cannot modify the PORT value. Is there any alternate or only option is to use ICD tool