Skirmitt
Joined: 19 May 2009 Posts: 60
|
Migrating from pic16 to pic18 |
Posted: Tue Feb 07, 2012 4:04 am |
|
|
I have a project that runs perfect on pic16f886. I now need the µc to work faster so I plugged a 18f2685 in I had from a previous project.
Problem now is I can't get the INT on port B working. On port B there are 3 rotary encoders that generate INT's.
Code that matters:
Code: |
#include <18F2685.h>
#device ADC=10
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=32000000)
#use rs232(baud=31250, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
int b=0;
int newencoder=0;
int lastencoder=0;
int newencoder2=0;
int lastencoder2=0;
int newencoder3=0;
int lastencoder3=0;
#include "readencs.h"
#int_rb
void int_rb_isr(void)
{
b = input_b();
newencoder = b & 0b00000011;
newencoder2 = b & 0b00001100;
newencoder3 = b & 0b00110000;
}
void main()
{
enable_interrupts(INT_RB);
enable_interrupts(GLOBAL);
while(1)
{
encoder1();
encoder2();
encoder3();
readbuttons();
}
}
|
Schematics: http://mylantec.be/upload/PICMIX.pdf
With the PIC16F I had to declare all the port B INT pins seperately but for 18f series you can't do that ? |
|