AllDigital routine for P16 and P18 MCU

General discussion on mikroBasic.
Author
Message
yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

AllDigital routine for P16 and P18 MCU

#1 Post by yo2lio » 02 Jul 2008 13:23

Hello,

AllDigital routine for P16 and P18 MCU is ready !

This routine set all pins from MCU to I/O digital state ( turn off comparators, analog to digital converters and external memory bus)

Code: Select all

program AllDigital

include "all_digital"

main:
  AllDigital  ' turn off comparators, analog to digital converters
              ' and external memory bus, depending of MCU type
end.
You can download the code from :
http://www.microelemente.ro/MikroBasic/ ... igital.zip
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Jack Flanders
Posts: 337
Joined: 17 Apr 2008 02:53
Location: Fantasy Land

#2 Post by Jack Flanders » 02 Jul 2008 17:05

8)
Great job, yo2lio! This should help a lot of folks... it's also a good starting point for someone who wants to use A/D or comparator functions. The registers you show are ones the user will need to change to use analog functions so your code helps everyone out!

Thanks for posting! :D

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#3 Post by yo2lio » 02 Jul 2008 17:19

I can put this routine, for easiest implementation, in Delays routine both P16 and P18, but I waiting for users feedback ...
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

ch9fod
Posts: 54
Joined: 10 May 2008 22:08
Location: Mexico

#4 Post by ch9fod » 02 Jul 2008 20:18

Are we going to see a version for mikroC??
Thx!
Ch9FOD

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#5 Post by yo2lio » 02 Jul 2008 20:53

ch9fod wrote:Are we going to see a version for mikroC??
If somebody show me how can I implement this in MC , ... the answer is yes ....
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

zan
Posts: 434
Joined: 15 May 2007 19:35

#6 Post by zan » 05 Jul 2008 21:05

Thankyou Florin

BTW. This topic should be sticky.

MobyUK
Posts: 12
Joined: 17 Jun 2008 13:57

#7 Post by MobyUK » 25 Nov 2008 16:42

Very useful addition.
Now a stupid question :? where would you put this so the compiler can pick it up for all projects?

Colin
Posts: 738
Joined: 15 Oct 2007 08:53
Location: Australia

#8 Post by Colin » 26 Nov 2008 09:13

Its not a stupid question.
Put it in the same folder as your project.

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#9 Post by yo2lio » 26 Nov 2008 09:56

Well it' not so easy.

You must spit this library in two parts.
You must make two procedure for P16 and P18.

Hard way :

Copy this files in /Uses/P16 and /Uses/P18 folder and then edit all *def.pbas files from Defs folder ! No way !

Easy way :

Edit Delay.pbas file from /Uses/P16 and /Uses/P18 and include AllDigital procedure in this files.

Before this make a copy for Delay.pbas .

If time permitted I'll make this and upload Delay.pbas files on the forum.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Colin
Posts: 738
Joined: 15 Oct 2007 08:53
Location: Australia

#10 Post by Colin » 27 Nov 2008 09:30

Hello yo2lio,
Thats weird.
I just copied the "all_digital.mcl" file to my project directory.
All my projects compile and run without errors.
I just modified a onewire project (18s20), commented out ADCON1 =7 and the display read 000.0000.
I then included the "all_digital.mcl", added AllDigital as the first statement in Main: and the display read 024.5000.
Am I just lucky??

Regards
Colin

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#11 Post by yo2lio » 27 Nov 2008 18:54

Colin wrote:I then included the "all_digital.mcl", added AllDigital as the first statement in Main: and the display read 024.5000.
Am I just lucky??
This is the way to use custom libraries. But if you want to have access to library without include "name_lib" you must follow the steps presented in previous post.
Last edited by yo2lio on 28 Nov 2008 09:33, edited 1 time in total.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Colin
Posts: 738
Joined: 15 Oct 2007 08:53
Location: Australia

#12 Post by Colin » 28 Nov 2008 09:24

Thanks for the explanation Florin.
I will try it the other way as well.

cllow2020
Posts: 106
Joined: 06 Nov 2007 10:26

Re: AllDigital routine for P16 and P18 MCU

#13 Post by cllow2020 » 02 May 2009 01:22

yo2lio wrote:Hello,

AllDigital routine for P16 and P18 MCU is ready !

...
from some device define#

Code: Select all

ANSEL = ANSEL and %1110000
looks like missing LSB bit 0, total of 7 bits only, not 8bits, its not working for POARTA.4 as digital IO, or am i looking at wrong datasheet? :roll: b'cos i'm new to 18F25k20 .

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#14 Post by yo2lio » 02 May 2009 07:47

Hello,

Thank you for reporting.

Affected devices : P16F883, P16F886, P18F24K20, P18F25K20, P18F26K20.

Corrected and updated on server.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

firstgrip
Posts: 1
Joined: 22 Dec 2009 06:09
Contact:

Takes time to digest

#15 Post by firstgrip » 22 Dec 2009 06:13

Thanks. I need to take some time to digest the content. Complicated.
[url=http://www.loseweightweekly.com]Lose Weight In A Week[/url]

Post Reply

Return to “mikroBasic General”