![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| hello all, i am migrating from 16f to 18f. first i am trying with 18f4431 and blinking led... as usual. the problem is, when i try to program the uC for the first time, it succeeds. but for second time, programming fails again and again. i am using HARDWARE: jdm programmer v 5.2 SOFTWARE: WinPic even i tried with another new 18f4431. i got the same result. i am using 20Mhz Xtal. i selected HS mode and disabled all other settings in CONFIG WORD can any one please give the configuration settings for minimum operation like led testing? Thanks for reading...
__________________ Thiru | |
| |
| | (permalink) |
| You sure you've not got 18C4431's? | |
| |
| | (permalink) |
| People seem to have mixed results using JDM style programmers. I wonder if you're using INTOSC and MCLRE off? If so, this may cause a problem with any programmer which does not control the VDD line to the target. Here's the configuration fuse settings I've used for a couple recent projects. You can probably skip all of the 'protection' fuses for now. Good luck. Regards, Mike Code: list p=18F4431, b=8, c=102, n=71, t=on, st=off, f=inhx32
;******************************************************************
;* *
;* Filename: 18F4431 Boot 24.asm (v2.4) *
;* Author: Mike McLaren, K8LH (k8lh@arrl.net) *
;* Date: 18-May-05 (last rev 09-Apr-08) *
;* *
;* 18F4431 Serial Boot Loader Program (08/64 algorithm) *
;* based in part on early Microchip code examples *
;* *
;* - 8 MHz INTOSC or HS Crystal oscillator *
;* - occupies 0000-01FF code space (256 words) *
;* - RS-232 interface, 19.2 kb, <Xon> <Xoff> handshaking *
;* - inputs raw hex files which may contain code space holes *
;* *
;* MPLab: 8.01 (tabs = 8) *
;* MPAsm: 5.15 *
;* *
;******************************************************************
processor PIC18F4431
include "p18f4431.inc"
;-< radix, clock, and BRG constants >------------------------------
radix dec
clock equ 8 ; 8 MHz INTOSC
brgval equ (clock*1000000/19200/16)-1
;-< configuration fuses >------------------------------------------
if clock == 8 ;
config OSC = IRCIO ; INTOSC, RA6 and RA7 I/O
else ;
config OSC = HS ; hs xtal oscillator
endif
config FCMEN = OFF ; fail-safe clock monitor disabled
config IESO = OFF ; oscillator switchover disabled
config PWRTEN = ON ; power up timer on
config BOREN = OFF ; brown out reset enable on
config BORV = 45 ; brown out reset voltage 4.5v
config WDTEN = OFF ; watchdog timer disabled
config WINEN = OFF ; watchdog timer enable window
config WDPS = 16 ; watchdog timer prescaler
config T1OSCMX = OFF ; timer1 oscillator MUX
config HPOL = HIGH ; high side transistor active high
config LPOL = HIGH ; low side transistor active high
config PWMPIN = OFF ; PWM pin reset state control
config MCLRE = ON ; MCLR pin enabled
config EXCLKMX = RC3 ; external clock MUX bit
config PWM4MX = RB5 ; PWM4 MUX bit
config SSPMX = RD1 ; SSP I/O MUX bit
config FLTAMX = RD4 ; FLT MUX bit
config STVREN = OFF ; stack overflow/underflow reset
config LVP = OFF ; low voltage programming
config DEBUG = OFF ; background debug off
;-< code protection fuses >----------------------------------------
config CP0 = OFF ; Block 0 (000200-0007FFh)
config CP1 = OFF ; Block 1 (000800-000FFFh)
config CP2 = OFF ; Block 2 (001000-0017FFh)
config CP3 = OFF ; Block 3 (001800-001FFFh)
config CPB = OFF ; Boot (000000-0001FFh)
config CPD = OFF ; EEPROM
;-< write protection fuses >---------------------------------------
config WRT0 = OFF ; Block 0 (000200-0007FFh)
config WRT1 = OFF ; Block 1 (000800-000FFFh)
config WRT2 = OFF ; Block 2 (001000-0017FFh)
config WRT3 = OFF ; Block 3 (001800-001FFFh)
config WRTB = OFF ; Boot (000000-0007FFh)
config WRTC = OFF ; Config (300000-3000FFh)
config WRTD = OFF ; EEPROM
;-< read protection fuses >----------------------------------------
config EBTR0 = OFF ; Block 0 (000200-0007FFh)
config EBTR1 = OFF ; Block 1 (000800-000FFFh)
config EBTR2 = OFF ; Block 2 (001000-0017FFh)
config EBTR3 = OFF ; Block 3 (001800-001FFFh)
config EBTRB = OFF ; Boot (000000-0007FFh) | |
| |
| | (permalink) |
| are you kidding me? any way... my chip ic pic18f4431. thanks for your reply..
__________________ Thiru | |
| |
| | (permalink) | |
| Quote:
Then try to put your software either assembly or C on the net so that others could suggest you. In the absence, it would be difficult to imagine. Why use word like kidding-- after all who has time for all that. The V5.2 programmer has Vpp before Vdd link keep it in the Vpp before Vdd side.
__________________ Regards, Sarma. Last edited by mvs sarma; 7th July 2008 at 01:17 PM. | ||
| |
| | (permalink) |
| ok i wil try that.. my code has nothing but, #include <pic18fxx31.h> void main(void) { ANSEL0 = 0x00; ANSEL1 = 0x00; TRISA = 0x00; TRISB = 0x00; TRISC = 0x00; TRISD = 0x00; TRISE = 0x00; for(; { PORTA = 0xFF; PORTB = 0xFF; PORTC = 0xFF; PORTD = 0xFF; PORTE = 0xFF; } }
__________________ Thiru | |
| |
| | (permalink) | |
| Quote:
__________________ Regards, Sarma. | ||
| |
| | (permalink) |
| you can often config the configuration word in the programmer application, configuring it in your code only helps because the programmer usually reads this and applies the configs accordingly | |
| |
| | (permalink) |
| I'm learning C18 too, and I've peeked at C30. In C18 config is easy, use the #PRAGMA statement. Code: #pragma config WDT=OFF,OSC=INTIO2,LVP=OFF | |
| |
| | (permalink) | |
| Quote:
Mike. | ||
| |
| | (permalink) | |
| Quote:
__________________ Regards, Sarma. | ||
| |
| | (permalink) |
| hello all, the include file pic18fxx31.h comes with hitech C compiler. it can be located in the following path where you have installed the compiler HI-TECH Software\PICC-18\pro\9.61>bin>includes Also my procedure is to set the CONFIG settings like internal/external Osc, etc at the time of programming i.e. through the programmer application software. Is it a right procedure ?
__________________ Thiru | |
| |
| | (permalink) | |
| Quote:
Here's a typical set of #pragma's for an 18F452: Code: // Configuration for PIC18F452 #pragma DATA _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H #pragma DATA _CONFIG2L, _BOR_ON_2L & _BORV_20_2L & _PWRT_OFF_2L #pragma DATA _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H #pragma DATA _CONFIG3H, _CCP2MX_ON_3H #pragma DATA _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L #pragma DATA _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L #pragma DATA _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H #pragma DATA _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L #pragma DATA _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H #pragma DATA _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L #pragma DATA _CONFIG7H, _EBTRB_OFF_7H Code: #pragma DATA _CONFIG1H, _OSC_INTIO67_1H #pragma DATA _CONFIG2H, _WDT_OFF_2H #pragma DATA _CONFIG3H, _MCLRE_ON_3H #pragma DATA _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L EDIT: For comparison, here's a #pragma for a 16F874A, which has only one config word: Code: // Configuration for PIC16F874A #pragma DATA _CONFIG, _CP_OFF & _PWRTE_OFF & _WDT_OFF & _HS_OSC & _LVP_OFF
__________________ ========================= Futz's Microcontrollers & Robotics ========================= Last edited by futz; 12th April 2008 at 07:26 AM. | ||
| |
| | (permalink) |
| And here is my 18F4620 LED blinky test program. Should work without change for 4431, except for compiler-specific changes. Download and install the BoostC demo and it should work with no changes. I switched from PICC to BoostC a while back for various reasons. The biggest reason was that I can actually afford to buy a license for BoostC. PICC is priced very high. The LED is on RD1: Code: #include <system.h>
#pragma DATA _CONFIG1H, _OSC_INTIO67_1H
#pragma DATA _CONFIG2H, _WDT_OFF_2H
#pragma DATA _CONFIG3H, _MCLRE_ON_3H
#pragma DATA _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
void delay(int);
void main(void)
{
unsigned char x;
trisd = 0;
for(x=0;x<6;x++)
{
latd.1 = 1;
delay(1);
latd.1 = 0;
delay(1);
}
while(1);
}
void delay(int len)
{
int x,y;
for(x=0;x<len;x++)
{
for(y=0;y<5000;y++){}
}
}
__________________ ========================= Futz's Microcontrollers & Robotics ========================= | |
| |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Title | Starter | Forum | Replies | Latest |
| Errors while programming a PIC16F874A | Kitt0s | Micro Controllers | 17 | 8th March 2008 08:12 PM |
| Question about Inchworm+ | Quan | Micro Controllers | 54 | 28th October 2007 01:21 AM |
| UNIT Committment solution using Dynamic programming | arijit18 | Electronic Projects | 1 | 18th October 2007 09:28 PM |
| Programming languages | sram | General Electronics Chat | 9 | 2nd March 2007 05:15 PM |
| Good Computer Programming Book | ThermalRunaway | Chit-Chat | 21 | 16th September 2005 11:05 PM |