CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Migrating from pic16 to pic18

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Skirmitt



Joined: 19 May 2009
Posts: 60

View user's profile Send private message

Migrating from pic16 to pic18
PostPosted: Tue Feb 07, 2012 4:04 am     Reply with quote

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 ?
Skirmitt



Joined: 19 May 2009
Posts: 60

View user's profile Send private message

PostPosted: Tue Feb 07, 2012 4:15 am     Reply with quote

Think I found it, 18f2685 doesn't have IOC on all pins, only the last 4.
Would there be a way to still be able to read the 3 encoders on pic18f ?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group