Who can help me checking my Programming


Closed Thread
Results 1 to 26 of 26

Hybrid View

  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.

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