Who can help me checking my Programming


Closed Thread
Results 1 to 26 of 26
  1. #1
    Join Date
    Jan 2008
    Posts
    28

    Default Who can help me checking my Programming

    'My programming running is like that.....i want my programming every 5second send out the data to bluetooth module and using the bluetooth transmitter to Receiver on PC bluetooth and also show the value on LCD.....so below is my programming i dunno correct or not hope same one can help me checking it and let me knw where i wrong it urgent...!



    ************************************************** **************
    '* Name : WIRELESS TEMP MONITORING SYSTEM.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 1/9/2008 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    include"modedefs.bas"
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 1
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    DEFINE OSC 4
    DEFINE ADC_BITS 8
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50
    DEFINE debug_mode 1
    DEFINE debug_reg portc
    DEFINE debug_bit 6
    DEFINE debug_baud 2400


    pause 2000
    LCDOUT 254,1,2,2,2,"WELCOME MY"
    LCDOUT 254,192,2,"MONITOR SYSTEM"
    pause 3000
    LCDOUT 254,1,16,2,"MY STARTING"
    LCDOUT 254,192,2,"TEMP IS: "

    TRISA=255
    TRISC.6=0
    TRISD=0
    TRISA.0=1
    B0 VAR BYTE
    baud con N2400

    MAIN:
    ADCON1=3
    ADCIN 0,B0
    if b0=0 then OUTT
    IF B0=10 THEN OUT
    IF B0=20 THEN OUT1
    IF B0=30 THEN OUT2
    IF B0=41 THEN OUT3
    IF B0=51 THEN OUT4
    IF B0=61 THEN OUT5
    IF B0=71 THEN OUT6
    IF B0=81 THEN OUT7
    IF B0=92 THEN OUT8
    IF B0=102 THEN OUT9
    IF B0=112 THEN OUT10
    IF B0=122 THEN OUT11
    GOTO MAIN

    OUTT:
    LCDOUT 254,201,2,"<0'C"
    SEROUT PORTC.6,baud, [#B0=0]
    pause 1000
    GOTO MAIN

    OUT:
    LCDOUT 254,201,2,"10'C "
    SEROUT PORTC.6,BAUD, [#B0=10]
    pause 1000
    GOTO MAIN

    OUT1:
    LCDOUT 254,201,2,"20'C "
    SEROUT PORTC.6,BAUD, [#B0=20]
    pause 1000
    GOTO MAIN

    OUT2:
    LCDOUT 254,201,2,"30'C "
    SEROUT PORTC.6,BAUD, [#B0=30]
    pause 1000
    GOTO MAIN

    OUT3:
    LCDOUT 254,201,2,"40'C "
    SEROUT PORTC.6,BAUD, [#b0=41]
    pause 1000
    GOTO MAIN

    OUT4:
    LCDOUT 254,201,2,"50'C "
    SEROUT PORTC.6,BAUD, [#b0=51]
    PAUSE 1000
    GOTO MAIN

    OUT5:
    LCDOUT 254,201,2,"60'C "
    SEROUT PORTC.6,BAUD, [#b0=61]
    pause 1000
    GOTO MAIN

    OUT6:
    LCDOUT 254,201,2,"70'C "
    SEROUT PORTC.6,BAUD, [#b0=71]
    pause 1000
    GOTO MAIN

    OUT7:
    LCDOUT 254,201,2,"80'C "
    SEROUT PORTC.6,BAUD, [#b0=81]
    pause 1000
    GOTO MAIN

    OUT8:
    LCDOUT 254,201,2,"90'C "
    SEROUT PORTC.6,BAUD, [#b0=92]
    pause 1000
    GOTO MAIN


    OUT9:
    LCDOUT 254,201,2,"100'C "
    SEROUT PORTC.6,BAUD, [#b0=102]
    pause 1000
    GOTO MAIN

    OUT10:
    LCDOUT 254,201,"110'C "
    SEROUT PORTC.6,BAUD, [#b0=112]
    pause 1000
    GOTO MAIN

    OUT11:
    LCDOUT 254,201,"120'C "
    SEROUT PORTC.6,BAUD, [#b0=122]
    pause 1000
    GOTO MAIN
    END

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    baud con N2400
    Won't work... A constant is a numeric value. N2400 may have a numeric value associated with it, but N2400 itself is not a numeric value.

    You've got DEBUG defined as PortC.6, and SEROUT going to the same place.
    Which one is it?

    SEROUT PORTC.6,baud, [#B0=0]
    #B0=0? What's that for? The manual doesn't have anything like that in it...

    How about some of this:
    Code:
    include"modedefs.bas"
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 1
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    DEFINE OSC 4
    DEFINE ADC_BITS 8 
    DEFINE ADC_CLOCK 3 
    DEFINE ADC_SAMPLEUS 50
    trisa = $ff : trisc = 0 : b0 var byte : pause 2000
    LCDOUT 254 , 1 , "   WELCOME MY   " , 254 , 192 , 2 , " MONITOR SYSTEM "
    pause 3000 : LCDOUT 254 , 1 , "  MY STARTING   " , 254 , 192 , "TEMP IS: "
    TRISA = 255 : TRISC.6 = 0 : TRISD = 0 : TRISA.0 = 1 : B0 VAR BYTE
    MAIN:    ADCON1 = 3 : ADCIN 0 , B0 : lcdout 254, 201, "<"
    if b0 = 0 then lcdout 254, 201, " "
    lcdout 254, 202, DEC ( b0 ) , "'C" : serout portc.6, n2400, #b0
    pause 5000 : goto main
    END
    Lots of colons, shorter, easier to read in my mind...yes...Your job to figure out what's different. It's all in the manual.
    But the main thing is...
    We've got no idea which PIC you're using, which version of PBP, no idea what the problem is that you are having (although I can guess by looking at your code), no idea what your circuit actually looks like...

  3. #3
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    hello i using PIC 16F877A and the B0 is the ADC after convert and i also using the temperature sensor to detect the temperature and every 5s i want the lcd show out my result at the same time i also need to send out the result to host bluetooth on pc at there also will show out the same result....so what should i do it............!i hope u all can help me....urgent..........!!! thanks a lot ..........!!!!

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by slimpeng View Post
    hello i using PIC 16F877A and the B0 is the ADC after convert and i also using the temperature sensor to detect the temperature and every 5s i want the lcd show out my result at the same time i also need to send out the result to host bluetooth on pc at there also will show out the same result....so what should i do it............!i hope u all can help me....urgent..........!!! thanks a lot ..........!!!!
    Did you see Post #2?

    Do you want the program written FOR you, hardware built FOR you, hand delivered TO you? Tomorrow?

    The program in Post #2 is practically written FOR YOUR PARTICULAR APPLICATION! HELLO!!! Anybody Home!!! McFLY!!!
    That is of course IF your hardware is set up right. And another thing, we'd need to know what kind of temperature sensor you're using...
    Is it a DS1820 type thing?
    A Alumel/Chromel thermocouple pair connected to an op-amp?
    A handheld infrared laser detector with an analog output?
    An ape slapping a stick on the ground with a candle at his feet, the hotter his feet, the harder he slaps the ground, the ground is a pressure sensitive resistor tied to a voltage divider network?)

    Heck, I even put a 5 second delay in there.

    Do you want the PC code and Bluetooth interface code written too?

    If it's that urgent, why didn't you get it done earlier?
    'school project' gone bad?
    Maybe you can pay somebody to do it for you...oh...wait...I think I already did. Where's my money?


    I'm out...
    Last edited by skimask; - 17th January 2008 at 05:20.

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi slimpeng,
    to start off with, replace baud con N2400, with baud con 4 , that will give you mode 4 which is N2400. You have several sub directories which output set temps, which the IF then loop will only address if the B0 variable exactly matches the number. what if the number is 11 or 19? the loop misses and goes around again, unless you do an AND less than type statement, I am curious as to why not lose all those subdirectories and output the actual B0 variable if it holds the accurate temp.something like:
    Code:
    loop:
     LCDOUT 254,201,"The Temp is"#B0 'or
     SEROUT PORTC.6,BAUD, ["The Temp is",#B0] 
    goto main
    HTH
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  6. #6
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Do you want the program written FOR you, hardware built FOR you, hand
    delivered TO you? Tomorrow?

    The program in Post #2 is practically written FOR YOUR PARTICULAR APPLICATION!
    HELLO!!! Anybody Home!!! McFLY!!!
    Frustration-Aggression Theory:

    Frustration is a feeling of tension that occurs when our
    efforts to reach some goal are blocked. When this occurs,
    it can produce feelings of anger, which in turn can generate
    feelings of aggression and aggressive behavior. This theory
    has been utilized to explain a lot of violent behavior over
    time. For example, some have stated that people who become
    frustrated with their jobs because they don't like their work,
    can't get the raise they want, etc., but can't take out their
    aggressions at work (can't yell at the boss, can't punch
    annoying co-workers), will redirect this frustration and act
    aggressively toward others.



    Jeremy,

    If you don't have any patience, do not participate in this forum!

    Best regards,

    Luciano

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Luciano View Post
    Jeremy,
    If you don't have any patience, do not participate in this forum!
    Best regards,
    Luciano
    Holy crap...
    I've got loads of patience, LOADS I tell ya, hours and hours of it, sitting around waiting to be used...
    But, again, holy crap, when the answer, or at least a fairly decent chunk of an answer is sitting right there...RIGHT THERE in front of a person...I mean, jeez, how much more prompting does a person need to get off their rear end and try to figure something out.

  8. #8
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Now i attach my circuit diagram...for u all see so the progrmming can running this circuit or not....
    Attached Images Attached Images  

  9. #9
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by slimpeng View Post
    Now i attach my circuit diagram...for u all see so the progrmming can running this circuit or not....
    'bout time.
    Check your other thread...

  10. #10
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Thumbs down Dude! Take a chill pill! Better yet a sabbatical...

    Quote Originally Posted by skimask View Post
    Holy crap...
    I've got loads of patience, LOADS I tell ya, hours and hours of it, sitting around waiting to be used...
    But, again, holy crap, when the answer, or at least a fairly decent chunk of an answer is sitting right there...RIGHT THERE in front of a person...I mean, jeez, how much more prompting does a person need to get off their rear end and try to figure something out.
    I'm probably not the only one that hesitates asking a simple question for fear of getting a verbal lashing for reading and not understanding the information provided either in responses or the data sheets. Or having to have our project pre-approved by you before making a suggestion. In my searches to my questions through out this forum, to keep from "bothering the experts", I found that one thing is evident, it's not the year 2004 when there seemed to be an eagerness to "help" upcoming PBP users. Your definition of patience is warped and unfortunately it seems to me that some of the other "experts" are getting tired too.
    If you feel your forehead forming a scowl as you read someones annoying and dumb question, do us a favor... don't respond. Because a lot of us are not at the same experience level you are and don't need the added aggrevation that comes with learning something new.
    My two cents.

  11. #11
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by LinkMTech View Post
    I'm probably not the only one that hesitates asking a simple question for fear of getting a verbal lashing for reading and not understanding the information provided either in responses or the data sheets.
    Big difference between trying to 'read and understand the information'...and not having done squat to help yourself.

    Or having to have our project pre-approved by you before making a suggestion.
    Hey, I'm a choad like the rest of the shmucks around here, I know, they know it...Dig it...

    Your definition of patience is warped and unfortunately it seems to me that some of the other "experts" are getting tired too.
    I just might be able to draw a bit of a conclusion there...Ya think?

    If you feel your forehead forming a scowl
    Scowl? No... Roll of the eyes? Maybe... Laughter? Ok, I'll buy that one.

    do us a favor... don't respond.
    Too late...

    Because a lot of us are not at the same experience level you are and don't need the added aggrevation that comes with learning something new.
    Guess how I got that much experience?
    There wasn't much for forums back then...

    My two cents.
    Taken...

  12. #12
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    HELLO...skimask.....i want to ask u some thing....your post 2 the programme i can use it...if i want the temperature reach to 60oC and on alarm so wat the comment should i wirte it...the comment is like if portc.6=60oC then portd =1 rite or not.............if cant can u write down and example for me see it....
    thanks u so much

  13. #13
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by slimpeng View Post
    HELLO...skimask.....i want to ask u some thing....your post 2 the programme i can use it...if i want the temperature reach to 60oC and on alarm so wat the comment should i wirte it...the comment is like if portc.6=60oC then portd =1 rite or not.............if cant can u write down and example for me see it....
    thanks u so much
    Sure...I'll be right over there to write the code for you.
    I'll even bring my whole setup...PC, keyboard, mouse, all my books...heck, I'll even bring over working hardware and donate it ALL to you...
    Just for you...
    I'll even bring the beer and some refreshments and a couple of DVDs, a big screen TV and a surround sound system to help pass the time...

  14. #14
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    hello....skimask........no need say like that ok......if i can done well at picbaisc pro i no need come here to ask u ad....so this is my last question ad...so help me last time ok pls....
    at post 12.....i really duno i try many time ad still cant working....

    i want the temperature reach to high oC around 60 to 100oC will go to on the alarm at port D after lcd will show out temperature is too Hot.....that all....

    hope skimask can help me....pls.............i really duno......pls............

  15. #15
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by slimpeng View Post
    hello....skimask........no need say like that ok......if i can done well at picbaisc pro i no need come here to ask u ad....so this is my last question ad...so help me last time ok pls....
    at post 12.....i really duno i try many time ad still cant working....

    i want the temperature reach to high oC around 60 to 100oC will go to on the alarm at port D after lcd will show out temperature is too Hot.....that all....

    hope skimask can help me....pls.............i really duno......pls............
    I'll be right over...
    Super swell good and dandy fine ok then?

  16. #16
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    hello skimask....sorry to disturb u again....my last part progrme on the alarm u help me write over ad mah..........i very urgent need that part if i not i will die.....it and help me......pls...help ppl god also will protect u and give u every day good luck for u.......thannks u very much......!!!!!

  17. #17
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by slimpeng View Post
    i very urgent need that part if i not i will die
    A cry for help?
    help ppl god also will protect u and give u every day good luck for u
    What?

  18. #18
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    Hello....i Really Want To Cry Ad....i Hope Some One Can Help...it Only The Last One Commnet.......for My Temperature.........help//help///help///!!!!

  19. #19
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    HELLO skimask your post 2 source code...i can use in the my hardware part now i facing the problme is the temperature sensor no stable...i using the voltage divide rule to give the input on port A.0 rite...and when i start running the temperature will going to high to 255oC and why no stable same time i not use the sensor to burn on fire the value will automative increase or decrease and now i knw how to on the alarm on the portd ad...i try whole night and get the result ad....thanks....and who can let me kwn why the temperature sensor on this source code cant working stable and who can give me ideal or commnet....!

    thanks....!

  20. #20
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by slimpeng View Post
    HELLO skimask your post 2 source code...i can use in the my hardware part now i facing the problme is the temperature sensor no stable...i using the voltage divide rule to give the input on port A.0 rite...and when i start running the temperature will going to high to 255oC and why no stable same time i not use the sensor to burn on fire the value will automative increase or decrease and now i knw how to on the alarm on the portd ad...i try whole night and get the result ad....thanks....and who can let me kwn why the temperature sensor on this source code cant working stable and who can give me ideal or commnet....!
    thanks....!
    Know what a 4-20mA current loop is?

  21. #21
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    yup i know 4-20mA.....so wat should i do it now.....need to change the sensor or jst adding the resistor.......wat valuse of the resistor i need to change it....

  22. #22
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by slimpeng View Post
    yup i know 4-20mA.....so wat should i do it now.....need to change the sensor or jst adding the resistor.......wat valuse of the resistor i need to change it....
    You send me the board your prototype is sitting on, and I'll GIVE you the resistor you need.
    Ever heard of a DS1820 or it's derivatives?

  23. #23
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    now i using the voltage divider rule and the resister i will 18ohm and the test cricuit i will post at below and i got hear that D1820 that is digital temperature sensor...but i duno how to use it...i no use that before....and now how to make the sensor become stable.......

    on the pict the blue colour is my temperature sensor....
    and the resistor value is 18ohm
    and the red colour wire i connet to ADC on port A.0
    and the whole the circuit i also post at here ad...i hope u can help me....

    if really want to change the sensor D1820 the circuit how it look like and where can get it and the programe need to write again or not need...!
    Attached Images Attached Images    

  24. #24
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi slimpeng,
    Here! Already written, and links to where to get it. You will be here 2 years from now trying to accomplish your goal with that thermistor. Oh, and please do try to use Google, it really does work to bring you good things, like data sheets, vendors, etc. . .

    http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2815/t/al

    Code:
    @MyConfig = _HS_OSC & _WDT_ON & _PWRTE_ON & _LVP_OFF 
    @MyConfig = MyConfig & _BODEN_OFF 
    @ __config  MyConfig
    ' One-wire temperature for LAB-X1 and DS1820
    Define PIC16F877A
    @ errorlevel -230
    temperature  Var	Word			' Temperature storage
    count_remain Var    Byte	 	    ' Count remaining
    count_per_c  Var	Byte			' Count per degree C
    
    DQ	Var	PORTC.0			' One-wire data pin
    define OSC 20
    TrisA = %00000000
    TrisB = %11111111
    
    ' Define LCD registers and bits
    DEFINE LCD_DREG PORTA
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTA
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTA
    DEFINE LCD_EBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 4
    DEFINE LCD_COMMANDUS 2000	 'Define delay time between sending LCD commands
    DEFINE LCD_DATAUS 50	     'Define delay time between data sent.
    
      CMCON  = 7
    	ADCON1 = 7			' Set PORTA and PORTE to digital
    	Low PORTE.2			' LCD R/W line low (W)
    pause 500
    LCDOUT 254,1,"initializing"
    mainloop: OWOut DQ, 1, [$CC, $44]       ' Start temperature conversion
    
    waitloop: OWIn DQ, 4, [count_remain]	' Check for still busy converting
    	If count_remain = 0 Then waitloop
    
    	OWOut DQ, 1, [$CC, $BE]		' Read the temperature
            OWIn DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE, Skip 4, count_remain, count_per_c]
    
    	' Calculate temperature in degrees C to 2 decimal places (not valid for negative temperature)
    	temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c)
    	Lcdout $fe, 1, DEC (temperature / 100), ".", DEC2 temperature, " C"
    
    	' Calculate temperature in degrees F to 2 decimal places (not valid for negative temperature)
    	temperature = (temperature */ 461) + 3200
    	Lcdout $fe, $c0, DEC (temperature / 100), ".", DEC2 temperature, " F"
    
            Pause 1000                      ' Display about once a second
    
    	Goto mainloop			' Do it forever
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  25. #25
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by slimpeng View Post
    i will post at below and i got hear that D1820 that is digital temperature sensor...but i duno how to use it...i no use that before....and now how to make the sensor become stable.......
    if really want to change the sensor D1820 the circuit how it look like and where can get it and the programe need to write again or not need...!
    Datasheets?
    Google?
    Search the forum?

    I'm done and out...Too much time used up already...not enough legwork at the other end.
    The items referred to in Post #6 have run out.

  26. #26
    Join Date
    Jan 2008
    Posts
    28


    Did you find this post helpful? Yes | No

    Default

    last question....why the temperature going to high....oC and my LCD cant display any oC when going to low oC the LCD can display bck the value....why...! is my progrme problme...or what happen who can let me knw below is my new programe....!!!!

    help to check it


    '************************************************* ***************
    '* Name : UNTITLED.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 1/23/2008 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    Define LCD_DREG PORTB
    Define LCD_DBIT 4
    Define LCD_RSREG PORTB
    Define LCD_RSBIT 0
    Define LCD_EREG PORTB
    Define LCD_EBIT 1

    ' Define ADCIN parameters '

    Define ADC_BITS 8 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS
    include"modedefs.bas"

    TRISB=%11111111

    pause 2
    LCDOUT 254,1,2,2,2,"WELCOME MY"
    LCDOUT 254,192,2,"MONITOR SYSTEM"

    pause 3
    LCDOUT 254,1,"MY STARTING"
    LCDOUT 254,192,2,2,2,2,2,"TEMPERATURE"

    B0 var byte ' Create TEMPERATURE to store result

    TRISC.6=0
    TRISA = %11111111 ' Set PORTA to all input
    ADCON1 =%00001010 ' Set PORTA analog
    Low PORTB.2 ' LCD R/W line low (W)

    Pause 1000

    loop:

    ADCIN 0,B0 ' Read channel 0 to adval
    Lcdout $fe, 1 ' Clear LCD
    Lcdout "Value: ",DEC B0,"'C" ' Display the decimal value
    serout portc.6,n2400,[#b0]
    Pause 5000 ' Wait .5 second

    Goto loop ' Do it forever
    End

Similar Threads

  1. Data Programming Error at 0000
    By cpatnoi in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd May 2009, 03:37
  2. Problems programming
    By Lionheart in forum General
    Replies: 4
    Last Post: - 7th December 2008, 16:51
  3. PIC programming algorithm - where is it to find?
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th June 2007, 18:31
  4. Some questions for programming
    By fnovau in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2006, 16:04
  5. MELab Programming
    By tarr in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd March 2006, 13:36

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts