hi, by any chance is there any changes on the code if i change the pic18F26k20 to pic16f877a for the interfacing dc motor with PIC microcontroller?
<div id=”crayon-5ad0306e52468831680601-36″ class=”crayon-line crayon-striped-line”></div>
We have commented out what should be changed in the code and replaced with correct code.
Here is the summary:
Change LAT with PORT: Use PORT register to read and input or write an output when using the old models of PIC16F series, they don’t have the LAT register.
Delete these lines of codes:
// ANSEL = 0; // Configure Analog pins as digital Input/Output pins
// ANSELH = 0;
// OSCCON = 0x66; // configure OSCCON to use 8MHz internal Oscillator
Because there is no need to disable the analog function as pins with analog features are on PORTA and PORTE, no analog pin on PORTB. If you want to disable analog features on PORTA/PORTE, use the ADCON1 register.
This PIC does not have internal oscillator, so remove OSCCON =0x66, you must use an external crystal connected to pins 13 and 14.