Page 1 of 1

RA5 on 16f88

Posted: Wed Jun 20, 2012 11:19 pm
by siliconchip
hi all can anyone tell me how to light a led on a pic16f88 on Ra5 using flowcode i have done a simple flowchart but cannot get a led to light can anyone point me in the right direction please many thanks

Re: RA5 on 16f88

Posted: Thu Jun 21, 2012 5:33 am
by STibor
Hi
Look at the data sheet 10-th page.
RA5 MCLR input only can be.
http://ww1.microchip.com/downloads/en/d ... 30487c.pdf

Re: RA5 on 16f88

Posted: Thu Jun 21, 2012 11:43 am
by siliconchip
ok thanks my mistake but i see that RA6 RA7 can be either inputs or outputs how do i configure the pic16f88 to use these as outputs, flowcode allows these to light leds but when i use hardware i cannot light these leds on these ports ???????, what am i missing

Re: RA5 on 16f88

Posted: Thu Jun 21, 2012 12:56 pm
by STibor
Internal Oscillator with I/O on RA6 and RA7

Re: RA5 on 16f88

Posted: Thu Jun 21, 2012 5:05 pm
by Benj
STibor is correct it's probably a config setting you are missing.

Are you using the matrix EB006 programmer or HP488 dev board, I think only v7 and v8 EB006 boards support the extra two I/O pins when the oscillator jumper is in the I/O position.

Re: RA5 on 16f88

Posted: Fri Jun 22, 2012 12:31 pm
by siliconchip
hi benj i am using a developement board from mikroelektronica EASY PIC 5 in all other respects the board is fine and i have checked the book that came with the board for config settings but cannot get to light a LED on RA6 or RA7 could you please suggest another PIC possibly 18 - 20 pin with at least 6 outputs on porta for 6 LEDS and enough outputs on portb to run a 2x16 lcd must also have ADC cheers

Re: RA5 on 16f88

Posted: Fri Jun 22, 2012 12:42 pm
by dazz
How are you downloading the hex file to your easypic 5 ?? i use an easypic7 can you post your flowcode file

attached is a hex file try it and see if it works it should flash all led's on port a
test.hex
(840 Bytes) Downloaded 410 times

Re: RA5 on 16f88

Posted: Fri Jun 22, 2012 12:58 pm
by siliconchip
hi dazz i use mikro-prog suite from mikroelektronica for downlooading HEX ive only done a simple flowcode program just to see if i can light LEDS on the desired outputs if i can get either of these outputs to work i shall create something i have in mind

Re: RA5 on 16f88

Posted: Fri Jun 22, 2012 1:06 pm
by dazz
Have you set up mikroeprog in flowcode

Re: RA5 on 16f88

Posted: Fri Jun 22, 2012 2:30 pm
by siliconchip
i have tried your HEX file but when i load it into mikro prog i get "error at line 23 line to short"

Re: RA5 on 16f88

Posted: Fri Jun 22, 2012 3:03 pm
by dazz
ok can you post your flowchart up

and try these config settings before burning your flowchart see if it works

config.jpg
config.jpg (199.62 KiB) Viewed 13377 times

Re: RA5 on 16f88

Posted: Sat Jun 23, 2012 12:56 pm
by siliconchip
LED flashing on RA6

Re: RA5 on 16f88

Posted: Sat Jun 23, 2012 12:58 pm
by siliconchip
hex file

Re: RA5 on 16f88

Posted: Sat Jun 23, 2012 1:09 pm
by siliconchip
looking closely at my board i have noticed that because i am using a 4MHz crystal this is connected to RA6 and RA7 on the 16f88, therefore i think i will need to use an internal oscillator on the chip to free these two ports up how do i initialise this timer through flowcode ????

Re: RA5 on 16f88

Posted: Sat Jun 23, 2012 1:33 pm
by kersing
To set the oscillator you will have to use a C code block to set osccon to the desires value.

For a 4 MHz clock enter the following in the C code block (remove all existing text):

Code: Select all

osccon = 0x60;
Also in the processor configuration dialog of mikroProg set Oscillator to INTRC with both RA6 and RA7 as I/O.

Re: RA5 on 16f88

Posted: Sat Jun 23, 2012 1:54 pm
by siliconchip
hi i have entered osccon = 0x60; as suggested , i notice on the data sheet that the following is said about internal oscillator "Internal oscillator block:
- 8 user selectable frequencies: 31 kHz,
125 kHz, 250 kHz, 500 kHz, 1 MHz, 2 MHz,
4 MHz, 8 MHz

what do i need to change in the c code to choose different frequencies

Re: RA5 on 16f88

Posted: Sat Jun 23, 2012 2:23 pm
by kersing
To select different frequencies change the value of osccon. See chapter 4.6.3 of the data sheet for the bits in the register.

The osccon values are:
0x70 : 8MHz
0x60 : 4MHz
0x50 : 2Mhz
0x40 : 1Mhz
0x30 : 500kHz
0x20 : 250kHz
0x10 : 125kHz
0x00 : 31.25kHz

Re: RA5 on 16f88

Posted: Sat Jun 23, 2012 3:33 pm
by siliconchip
excellent thanks for the info i now can use RA6 and RA7 as outputs as well as internal oscillator thanks to all for your contributions