Hy. I have a question about port B PIC16F88 mcu. I try to flashing the eight leds of port B with a delay of 1 sec (trisb=0 - all pins are outputs). I can't to setup the last 2 pins of port B like an outputs. I sure that they can be set like an output because in electrical drawings is specified. These 2 pins also can be setup like an analog channel. To deactivate to work like an analog channel I set the ansel=0; (digital I/O) but the compiler does not recognize the ansel register. What is the corect syntax ? Also i deactivate RB Port Change Interrupt Enable bit, but the pins RB7 and RB6 are always ON. Can somebaody give some tips ? Thank you. ![]() |
Posts must have a topic tag in the subject line, I added [PIC] - Bob
On Mon, Feb 4, 2013, at 07:27 AM, mircea2012 wrote: > > Hy. > > I have a question about port B PIC16F88 mcu. > I try to flashing the eight leds of port B with a delay of 1 sec (trisb=0 > - > all pins are outputs). > I can't to setup the last 2 pins of port B like an outputs. I sure that > they > can be set like an output because in electrical drawings is specified. > These 2 pins also can be setup like an analog channel. To deactivate to > work > like an analog channel I set the > ansel=0; (digital I/O) but the compiler does not recognize the ansel > register. What is the corect syntax ? > Also i deactivate RB Port Change Interrupt Enable bit, but the pins RB7 > and > RB6 are always ON. > Can somebaody give some tips ? > Thank you. > > <http://microcontrollers.2385.n7.nabble.com/file/n180532/Untitled.png> > > > > -- > View this message in context: > http://microcontrollers.2385.n7.nabble.com/PIC16F88-tp180532.html > Sent from the MicroControllers - PIC mailing list archive at Nabble.com. -- http://www.fastmail.fm - A no graphics, no pop-ups email service -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
Hello,
Could you show me the configuration word you set for this device? Zsolt -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
In reply to this post by Bob Blick-4
> the compiler does not recognize the ansel register
That can happen if the project hasn't been configured with the correct micro or includes, eg list P = 16F88 include "P16f88.inc" __CONFIG _CONFIG1, _CP_OFF & _HS_OSC & _MCLR_ON & _WDT_OFF & _PWRTE_OFF & _BODEN_OFF & _LVP_OFF __CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF For 16F88 project with no analogue, all outputs banksel trisb movlw b'00000000' movwf trisb banksel option_reg movlw b'10000000' ; 1 pullups off movwf option_reg banksel ansel movlw b'00000000' ;all digital movwf ansel banksel cmcon movlw b'00000111' ;comparators off movwf cmcon Joe -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
In reply to this post by Bob Blick-4
Hi,
On Mon, Feb 4, 2013, at 07:27 AM, mircea2012 wrote: >> Hy. >> >> I have a question about port B PIC16F88 mcu. >> I try to flashing the eight leds of port B with a delay of 1 sec (trisb=0 >> - >> all pins are outputs). >> I can't to setup the last 2 pins of port B like an outputs. I sure that >> they >> can be set like an output because in electrical drawings is specified. The last 2 pins of Port B are also used to connect the programmer (and you used...). >> These 2 pins also can be setup like an analog channel. To deactivate to >> work >> like an analog channel I set the >> ansel=0; (digital I/O) but the compiler does not recognize the ansel >> register. What is the corect syntax ? Which language/compiler are you using? >> Also i deactivate RB Port Change Interrupt Enable bit, but the pins RB7 >> and >> RB6 are always ON. >> Can somebaody give some tips ? Why can try but remember that we need more exaustive informations also! -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
Have you disabled the comparators ??
CMCON disable can be either 0x00 or 0x07 Mr Smiley :o) --- On Mon, 4/2/13, Nicola Perotto <[hidden email]> wrote: > From: Nicola Perotto <[hidden email]> > Subject: Re: [PIC] Re: PIC16F88 > To: "Microcontroller discussion list - Public." <[hidden email]> > Date: Monday, 4 February, 2013, 23:43 > Hi, > > On Mon, Feb 4, 2013, at 07:27 AM, mircea2012 wrote: > >> Hy. > >> > >> I have a question about port B PIC16F88 mcu. > >> I try to flashing the eight leds of port B with a > delay of 1 sec (trisb=0 > >> - > >> all pins are outputs). > >> I can't to setup the last 2 pins of port B like an > outputs. I sure that > >> they > >> can be set like an output because in electrical > drawings is specified. > The last 2 pins of Port B are also used to connect the > programmer (and you > used...). > > >> These 2 pins also can be setup like an analog > channel. To deactivate to > >> work > >> like an analog channel I set the > >> ansel=0; (digital I/O) but the compiler does not > recognize the ansel > >> register. What is the corect syntax ? > Which language/compiler are you using? > > >> Also i deactivate RB Port Change Interrupt Enable > bit, but the pins RB7 > >> and > >> RB6 are always ON. > >> Can somebaody give some tips ? > Why can try but remember that we need more exaustive > informations also! > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
In reply to this post by mircea2012
Flashing the first six leds LB5, LB4, LB3, LB2, LB1, LB0 with a delay of 1 sec.
I try to flash the leds in the same way : LB0, LB2, LB4, LB6 -- ON and LB1, LB3, LB5, LB7 -- OFF and after 1 sec LB0, LB2, LB4, LB6 -- OFF and LB1, LB3, LB5, LB7 -- ON #include<system.h> #pragma DATA _CONFIG, _CP_OFF & _PWRTE_OFF & _WDT_OFF & _HS_OSC & _LVP_OFF unsigned int counter = 0; void interrupt(void) { if((intcon & 0x05) && (intcon & 0x04)) { clear_bit(intcon, 2); counter++; if(counter == 30) { counter = 0; portb = ~portb; } } } void main(void) { ansel = 0x00; trisb = 0x00; portb = 0b10101010; tmr0 = 0; cmcon = 0x07; option_reg = 0b00000111; clear_bit(intcon, 3); set_bit(intcon, 7); set_bit(intcon, 5); while(1) { } } When I compile it I receive the next message : error : unknown identifier 'ansel' error : invalid operand 'ansel' |
Hi Mircea,
You need to put a topic tag in the subject line of your posts if you want them delivered to everyone. The correct topic tag for this post is [PIC] I added the last one for you. Now it's up to you. Just follow by example, look at all the posts on the Piclist and you'll see how it's done, or follow the links to the Piclist info page near the bottom of every post. Best regards, Bob On Tue, Feb 5, 2013, at 10:26 AM, mircea2012 wrote: -- http://www.fastmail.fm - Or how I learned to stop worrying and love email again -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist |
Free forum by Nabble | Edit this page |