PDA

View Full Version : Port Error, Someone tell me something



serial_bug
- 22nd November 2015, 23:02
Hi my friends,
I wrote my very simple program with pic basic pro version 2.6 and something went wrong. please check it my code

TRISB=0
Main:
PORTB = 7
PAUSE 200
PORTB = 0
PAUSE 200
GOTO Main
END

I put 3 LEDs in RB0, RB1 and RB2, I want all 3 LEDs want to be on and off. Here is the problem, all LEDs are on, but no OFF.
Someone can help me something? I used PIC16F628A with internal clock :confused:

Heckler
- 23rd November 2015, 17:50
check to make sure you set the port pins to be digital.
As I remember they come default as analog.

there is an include file called alldigital.pbp that you can include in your program that pretty much sets any PIC that you might use so that all the pins are digital

http://www.picbasic.co.uk/forum/attachment.php?attachmentid=7567&d=1419358332

that is if you know how to do an "include" file.

sorry I am at work so no time to elaborate.

go read this thread also...
http://www.picbasic.co.uk/forum/showthread.php?t=561&highlight=alldigital

Heckler
- 24th November 2015, 03:19
that is if you know how to do an "include" file.

Sorry, as I read this now that statement seems arrogant, which is not what I intended :o

I was just concerned that I was giving you a solution that you might not know how to take advantage of.

To do an include you just simply place the statement somewhere near the top of your code...

INCLUDE alldigital.pbp

and make sure to then place that file in the same directory where your program is also stored.

this then has the effect of inserting that file's contents into your program at the location where you made the INCLUDE statement.

I hope you got it working.
if not come back here there's lots willing to help.

serial_bug
- 24th November 2015, 16:04
Thank you so much Heckler, I guess you give me library file "alldigital.pbp". I m going to test it. But I am ok right now. I could find the problem. I substituted new microcontroller ic 16f628 and it worked well. So I think it may be bad IC. But I would like to test the old bad IC with library file which you gave me. Thanks a lot Heckler :D

serial_bug
- 29th November 2015, 14:32
Dear Heckler and forum friends
Today I got the real solution. I gave wrong solution reply to Heckler. My problem is Brown-Out reset. When I was installing hex file in 16f628 I choose BODEN to enable. That's gave me error. When I Disable it . It's ok. all my IC are good. Thank you very much Heckler :D

Art
- 30th November 2015, 02:28
That's still a problem that should be addressed.
If it's battery powered they might be flat.