Why not 16F1827?
I used it and think is a little monster.
Ioannis
Why not 16F1827?
I used it and think is a little monster.
Ioannis
Barry,
The 16F1825 looks very nice indeed. Seems to be pin compatible with the '684, has 4 times the amount of program memory and 8 times the amount of RAM and it has the USART. It's a bit more complicated than the '684 with all the peripheral multiplexed across the pins but don't let that put you off. I'd say it's a winner.
The 16F1827 looks nice but it's got less flash and less RAM compared to the 16F1825 (not a problem if you don't need it) and it's not pin compatible with the 16F684 - which the 16F1825 seems to be.
/Henrik.
Sweet
Thanks Henrik. I had already placed an order on Element 14 for two pieces as a precautony measure. They were quoting 2-3 days delivery so I hope to have the chips in time for the weekend.
I will study up on the datasheet and try to sort out what "critical" registers need to be set for my application. This sort of thing is not rely my forte so any hints or recommendations wold be greatly appreciated. It took me ages to work out tht the comparitors needed to be disabled on the '684 to make it work!
Cheers
Barry
VK2XBP
Barry, as I said I used the 1827 and it was a pain to find all correct settings. I had to enable PWM for two outputs.
I do not claim that the settings may be complete, and according to your needs you have to change some.
But is is a good start:
IoannisCode:ASM __config _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _CP_ON & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF __config _CONFIG2, _WRT_OFF & _PLLEN_ON & _LVP_OFF & _STVREN_OFF & _BORV_25 ENDASM DEFINE OSC 32 'Internal RC Oscillator with PLL DEFINE HSER_RCSTA 90h DEFINE HSER_TXSTA 24h DEFINE HSER_BAUD 115200 DEFINE HSER_SPBRG 68 DEFINE HSER_CLROERR 1 DEFINE ADC_BITS 10 ' Set number of bits in result (8, 10 or 12) DEFINE ADC_CLOCK 3 ' Set clock source (rc = 3) DEFINE ADC_SAMPLEUS 50 ' Set sampling time in microseconds OSCCON= %11110000 'PLL enabled, Internal RC-8MHz and PLL x 4 PORTB = 0:PORTA=0 TRISB = %10110111 TRISA = %00111111 ADCON0 = %00000001 ADCON1 = %10100011 ANSELA = %00000001 'ANS0 analog in, all ohters digital I/O ANSELB = %00000110 ' PB1,PB2 Analog inputs APFCON0 = %00000000 APFCON1 = %00000001 BAUDCON = %00011000 'Bit 4: 1 Inverted data on Tx, 0 Non inverted for direct serial use CCP1CON = %00111100 'Control of CCPx modules CCP2CON = %00111100 CCP3CON = %00000000 CCP4CON = %00000000 CM1CON0.7=0 CM2CON0.7=0 CPSCON0 = 0 CPSCON1 = 0 DACCON0 = 0 FVRCON = %10000011 INTCON = %11000000 ' global & peripheral ints enabled OPTION_REG = %01000111 'Tmr0 from 256 presc and Int Clock WPUB=%10110001 ' Weak pullup individual settings. See also on Option_Reg DEFINE CCP1_REG PORTB DEFINE CCP1_BIT 3 DEFINE CCP2_REG PORTB DEFINE CCP2_BIT 6 CCPTMRS=0 PR2=255 CCP1CON=$0C CCP2CON=$0C T2CON=%00000110 'Prescaller / 16, Timer2 ON
"#*&@"!!!!!
I don't think I could have worked that out in a month of Sundays! - Thanks Ioannis.
As Henrik stated, the 16F1825 is pin compatible with the '684 that I am currently using but your "head start" on setups will be invaluable in my future endeavours.
Henrik also asked the question
I think the answer to that is now self explanitory...Why do you need me for this ? ;-)
Thanks for all your help guys. I am sure I will be back with more questions very soon
Cheers
Barry
VK2XBP
Hi All,
I have had a bit of time to think about where I am going with this project and what my ultimate goal is.
As stated in my original message
I could spend time tweaking the current system, change the PIC (along with the extended learing curve associated with the new settings) but is it really worth it? At this stage I have proved the concept using the 24Vdc motor; proved it well enough to move forward to the final platform. I have decided to take the plunge and jump straight to the full blown design. Yeah, scary huh!The end use for this project is to re-power my 9x20 lathe using a treadmill motor (180Vdc 2HP).
The final system will require forward and reverse motor operation. This will be achieved using four IGBT's configured in an H-Bridge arrangement. The IGBT's will be fired by dedicated high-side and low-side gate drivers. All control circuitry will be isolated from the power circuit by opto-isolators (5kV isolation). Forward, reverse and stop (emergency) functions will be performed by switches on digital I/O lines, speed to be set by ADCin via a pot, feedback via photo-interrupter/shaft encoder wheel with an interrupt driven counter (eg. TMR0 and TMR1). As in the prototype system, gain terms will be set via individual pots with ADCin routines. Settings to be displayed on a serial LCD.
I have searched the Microchip website for an appropriate device and decided on the 18F2431. Quite a powerful device with lots of in-built functions dedicated to motor drive applications.
I now have lots of new information to try and get my head around. The 18F2431 datasheet is mammoth! I plan to piece the circuit diagram together, lay out a new pcb and then begin to learn the ways of driving the 18F2431. This won't happen overnight - but it will happen
Thanks to all those who have helped me get to this stage. I am sure I will be calling on you again in the very near future.
Any recommendations, suggestions or comments on what I am trying to do, before I embark on this adventure, would be greatly appreciated.
Cheers
Barry
VK2XBP
Hi Barry,
The 18F2431 is a wonderful device (a bit expensive but there's really no alternative in the 8bit line-up of PICs) and it is the chip I personally use with the PID routine (for info please see with a bit of "bench test demo".
I haven't used the PCPWM module in full bridge mode but I think there's a post somewhere around here, made by Bruce, with a nice example. Apart from that I know the 2431 pretty well so you won't be alone.
Keep it up!
/Henrik.
Bookmarks