Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help pic16f877a using mikrobasic

Status
Not open for further replies.

sheth_ka

Junior Member level 2
Joined
Aug 29, 2009
Messages
21
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,427
mikrobasic interrupt

hello,im a newbie on using pic16f877a,im familiar with pic16f84a but i got problem on pic16f877a..right now im using basic programming language (mikrobasic compiler)..

now i could only manage to manipulate the led blinking using pic16f877a,but i cannot add inputs like switches..i am currently developing a timer circuit using this pic16f877a..it is a 10min timer..in which it should have a pause, start, and reset switches..

on my ckt, i use 74LS247(decoder) combined with pic16f877a..i use the portB and portD of pic16f877a as output,then connect it into four 74LS247 to decode it for seven-segment display..

now my biggest problem is how can i add pause, start, and reset switches..my current progress is the straight count down of 10min timer..

im looking forward to anyone for reply..thanks!:|
 

sk_008

Newbie level 6
Joined
Aug 30, 2009
Messages
12
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Pakistan
Activity points
1,379
mikrobasic blink led

Hello Sheth_ka!
Well the type of application that you are designing requires the use of interrupts. For using three switches for start reset and pause you will have to use the 4 pins of port b <7:4> which are used as the port b change interrupt pins. Any change detected on these pins will stop the program and jump to the specified vector and this will require you to remove the 7 seg display connected to your port b and shift it to port c or a (make sure you use port a as digital i/o port)
For a newbie to pic16f877 "Interfacing Pic Microcontrollers by Martin Bates" is the best. If you donot have the book just drop your email address and ill send it you.
Good Luck!
 

pasicr

Advanced Member level 1
Joined
Aug 13, 2005
Messages
440
Helped
39
Reputation
80
Reaction score
29
Trophy points
1,308
Location
Macedonia
Activity points
4,213
using timer in microbasic

Hi SHETH_ka, if you using mikrobasic probably you visit mikroe.com, there you have free books to download, all you'r "problem" is there explained,
regards
 

sheth_ka

Junior Member level 2
Joined
Aug 29, 2009
Messages
21
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,427
pic16f877 + mikrobasic

pasicr said:
Hi SHETH_ka, if you using mikrobasic probably you visit mikroe.com, there you have free books to download, all you'r "problem" is there explained,
regards


yeah..ive already visit their site..ive downloaded the manual of the software..but still i cant understand some of the syntax..although it is somehow similar to microsoft visual basic..there something missing on their explaination,i dont know..anyway thanks for the reply..

Added after 28 minutes:

sk_008 said:
Hello Sheth_ka!
Well the type of application that you are designing requires the use of interrupts. For using three switches for start reset and pause you will have to use the 4 pins of port b <7:4> which are used as the port b change interrupt pins. Any change detected on these pins will stop the program and jump to the specified vector and this will require you to remove the 7 seg display connected to your port b and shift it to port c or a (make sure you use port a as digital i/o port)
For a newbie to pic16f877 "Interfacing Pic Microcontrollers by Martin Bates" is the best. If you donot have the book just drop your email address and ill send it you.
Good Luck!

hi, thanks for the reply..so i need to transfer my 7segdisplay from portb to a..and use the port b as input..thanks, ill try that..but the problem is..i dont know how to code it..ive attached pics of my code written in mikrobasic and the schematic diagram..please do see that..i haven't code the interrupts yet coz i dont know the syntax for it..

by the way im also interested on the book you have said..i would be glad if you send me a copy of that here's my email add..sheth_ka@yahoo.com:D
 

sk_008

Newbie level 6
Joined
Aug 30, 2009
Messages
12
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Pakistan
Activity points
1,379
how to use interrupts in pic 16f877a

Well Sheth_ka!
Why don't you use the multiplexing technique its easy and you will have your number of pins reduced too at the moment you have got 16 pins connected to your 7 segemnts by using multiplexing you will have just 7 for 7 seg and 4 pins for enabling your desired 7 seg that makes 11 pins
Have a look at this https://picnote.blogspot.com/2008/12/led-7-segment-multiplexing.html
I've sent you some others books too along with the one that i mentioned
Well i've got experience in coding in c or assembly but i think if you have a sample code in c or assembly there will be no problem in dealing with basic your code for timer seems to be very neat i think you will just have to introduce a fuction for 7 segment multiplexed display, introduce interrupts for your switches to be pressed and a timer interrupt too for your 10 minute timer because you know you're making your controller to do two different things at a time first a timer going on and polling your switches at the same time whether one of them is pressed or not and if pressed then controller should switch to the desired operation.
I suggest that you should give 2 or 3 days and study multiplexing and interrupts when you become familiar with the working of interrupts and multiplexing technique i'll definitely help you with the code but you know i have got no experience in picbasic but i'll show you the handling of interrupts in assembly or c and you'll be able to do in basic
Good Luck!
 

sheth_ka

Junior Member level 2
Joined
Aug 29, 2009
Messages
21
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,427
mikrobasic codes for pic16f877a

sk_008 said:
Well Sheth_ka!
Why don't you use the multiplexing technique its easy and you will have your number of pins reduced too at the moment you have got 16 pins connected to your 7 segemnts by using multiplexing you will have just 7 for 7 seg and 4 pins for enabling your desired 7 seg that makes 11 pins
Have a look at this https://picnote.blogspot.com/2008/12/led-7-segment-multiplexing.html
I've sent you some others books too along with the one that i mentioned
Well i've got experience in coding in c or assembly but i think if you have a sample code in c or assembly there will be no problem in dealing with basic your code for timer seems to be very neat i think you will just have to introduce a fuction for 7 segment multiplexed display, introduce interrupts for your switches to be pressed and a timer interrupt too for your 10 minute timer because you know you're making your controller to do two different things at a time first a timer going on and polling your switches at the same time whether one of them is pressed or not and if pressed then controller should switch to the desired operation.
I suggest that you should give 2 or 3 days and study multiplexing and interrupts when you become familiar with the working of interrupts and multiplexing technique i'll definitely help you with the code but you know i have got no experience in picbasic but i'll show you the handling of interrupts in assembly or c and you'll be able to do in basic
Good Luck!

i appreciate your advice of using multiplexers, i'd also visited the site you've included,but i need to use common anode 7seg display however multiplexers requires common cathode 7seg display, so it wont be applicable in my situation..thanks for the ebooks by the way..theyre all good..i have some time reading them..i wonder if you have PICBasic software or knows where to download its full version..hope you dont mind,but if you have sample code that applies switches or interrupts with pic16f877a, please send me that,it would be a big help for me while studying the pic16f877a..and also please include the schematic diagram for the hardware connections..thanks again..
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,866
Helped
4,856
Reputation
9,730
Reaction score
4,640
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
126,539
using 2 timers pic16f877

Multiplexers work with common cathode or common anode displays, you just reverse the drive signals to them.

Brian.
 

sk_008

Newbie level 6
Joined
Aug 30, 2009
Messages
12
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Pakistan
Activity points
1,379
program- mikrobasic- seven seg

Well sheth_ka I am attaching the Crownhill Proton IDE some of my fellows have used it and they found it good. I don't know whether its a full version or just an evaluation version you just check it up hope that it might help you i'll send you the schematic for multiplexing four 7 seg displays too and some programs but they're in assembly if you want them i'll send them to you
The book "Pic Basic Projects" contains a project in which multiplexing is involved its number is 14 so check that out too only you will have to add up two more displays in the similar way. Betwixt is right common anode and cathode both work i've used both of them as multiplexed displays.
 

sheth_ka

Junior Member level 2
Joined
Aug 29, 2009
Messages
21
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,427
using mikrobasic

yeah sure just send them to me, i wanna see the schematic and sample code that you have..
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top