Compiling error on Weather station code


+ Reply to Thread
Results 1 to 13 of 13

Thread: Compiling error on Weather station code24 days old

  1. #1
    Junior Member Broderic's Avatar
    Join Date
    Jan 2019
    Posts
    23
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    76.52 MB

    0 Not allowed!

    Default Compiling error on Weather station code

    Hello.
    When I try to compile the enclosed code (published feb 2013 by Les), I have 2 problems:

    1. sometimes it says at the end that it can't produce output file, highlight on first raw of comment
    2. sometimes it says that there are too much variables and not enough ram, but it seem strange since it has been done for Amicus18.

    Thank you for any suggestion.

    Regards
    Attached Files Attached Files

  2. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,582
    Thumbs Up
    Received: 337
    Given: 161
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    That code was originally written many years ago for the compiler that came with the Amicus18 board and its version of the Proton compiler so it included files that were for the Amicus18 board. The Proton compiler has evolved over time and there have been changes made, but the code compiles OK when the small changes are made to it.

    I've attached the program listing with the changes required made. The issues were:

    The microcontroller name was missing, because the Amicus18 compiler automatically knew what device to use.
    The preceding Declare directives were missing.
    The include files had to have the preceding text "Amicus18_" added to them because they are included with the Proton compiler, but had to have their names changed so they did not interfere with user include file names.
    The graphic LCD Font name for the Cdata tables was changed to Font_Table many,many years ago.

    You will need to alter the config fuses to get the devie to operate at 64MHz from a 16MHz crystal, but open the "Amicus18.inc" file to see what these are.

    WeatherStationCode_Altered.zip

  4. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Junior Member Broderic's Avatar
    Join Date
    Jan 2019
    Posts
    23
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    76.52 MB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    Many many thanks Les for your kind help!
    Regards

  6. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Junior Member Broderic's Avatar
    Join Date
    Jan 2019
    Posts
    23
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    76.52 MB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    Hello.
    My aim is to integrate the weather station with wind direction measurement.
    I remember I have seen once a routine for measuring wind direction angle using hall effect sensor, but I can't find it anymore.
    Does anyone know where I can find something like that?

    Thank you

  8. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,884
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    A couple of chips that I've used are the 10 bit AS5040 and the 12 bit AS5045.
    Both need a bipolar magnet.
    Alternatively you can buy read made encoders such as the HH-12. They talk via SSI. Easy to interface.
    Let me know if you want more info.
    John

  10. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,557
    Thumbs Up
    Received: 76
    Given: 33
    Total Downloaded
    6.56 GB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    Broderic,

    I think John Drew once wrote something but could not locate it.
    Regards

    Joseph

  12. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,884
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    I still have the code.
    John

  14. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Junior Member Broderic's Avatar
    Join Date
    Jan 2019
    Posts
    23
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    76.52 MB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    Thank you John, Joseph.
    Some indications on how to manage different voltage signals from different cardinal point could be appreciated.
    I remeber I saw something but I can't find it.
    Anyway, thank you so much.
    Regards

  16. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #9
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,557
    Thumbs Up
    Received: 76
    Given: 33
    Total Downloaded
    6.56 GB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    I remember a diagram showing a hall sensor and a magnet attached to a shaft. The output from the hall sensor differs according to rotation of the shaft. Something like this.
    Regards

    Joseph

  18. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #10
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,884
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    Download the datasheet for the AS5040 or AS5045. These devices are capable of giving fractional degree locations over 360 degrees and at quite high RPM.
    Here's an extract from the introduction to the AS5045.
    The AS5045 is a contactless magnetic rotary encoder
    for accurate angular measurement over a full turn of
    360°. It is a system-on-chip, combining integrated Hall
    elements, analog front end and digital signal processing
    in a single device.
    To measure the angle, only a simple two-pole magnet,
    rotating over the center of the chip, is required. The
    magnet may be placed above or below the IC.
    The absolute angle measurement provides instant
    indication of the magnet’s angular position with a
    resolution of 0.0879° = 4096 positions per revolution.
    This digital data is available as a serial bit stream and
    as a PWM signal.
    An internal voltage regulator allows the AS5045 to
    operate at either 3.3 V or 5 V supplies.
    This will provide much greater accuracy than you would require as a weather vane so there may be other solutions. Ready made encoders are available.
    Here's a link to my web page for the beam controller I built. There are now hundreds in use around the world, mostly for tracking the moon but also satellites. Use the menu on the page to find various encoders and how they work.
    http://www.vk5dj.com/beam.html

    John

  20. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  21. #11
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,582
    Thumbs Up
    Received: 337
    Given: 161
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    I used something similar many years ago to control a Galvanometer's position. I've looked and looked for the code I did but, unfortunately, can't find it.

    It was very easy to use and all it required was a magnet on the motor's shaft and the chip sitting underneath the motor so there was no physical connection to the motor or the need for very expensive capacitance or optic encoders that are part of the galvanometer motor.

  22. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  23. #12
    Junior Member Broderic's Avatar
    Join Date
    Jan 2019
    Posts
    23
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    76.52 MB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    Thank you very much, Joseph, John and Les for your kind assistance!
    Code:
     Include "Amicus18.inc"
     Include "Amicus18_ADC.inc" ' Load the ADC macros into the program
     Include "Amicus18_SPI.inc"
     Include "Amicus18_Timers.inc"
    
    
    
    
    
    
     Declare Watchdog = True
     Declare Float_Display_Type = LARGE
     Declare Internal_Font On
     'Declare Create_Coff = On  'to create file *.cof and MPLAB debug
     
      SSPCON1=%00000001
      Symbol SSPEN  = SSPCON1.5     ' SSP Enable bit
      Symbol CKP1    = SSPCON1.4     ' Clock Polarity Select
      Symbol SMP1   = SSPSTAT.7     ' Data input sample bit
      Symbol CKE1    = SSPSTAT.6     ' Clock Edge Select bit
      Symbol BF1     = SSPSTAT.0     ' buffer full status bit 1 = buffer full
      Symbol SSPIF  = PIR1.3      
      OSCCON=%01110000
      TRISC=%00010000
      TRISA=%00000011    
          
      Include "ST7565_DEF.inc"                        ' ST7565R Preprocessor & defines  
      Include "GLCD_ST7565R_SPI.inc"
        
     
       Dim nord As Byte
       Dim ne As Byte
       Dim e As Byte
       Dim sudest As Byte
       Dim sud As Byte
       Dim sw As Byte
       Dim w As Byte
       Dim nordw As Byte 
       Dim cyccount As Word 
       Dim cycle As Word                                  
     
    
    
     Symbol SDAPin = PORTC.0
     Symbol SCLPin = PORTC.1
     Declare SDA_Pin PORTC.0
     Declare SCL_Pin PORTC.1
    
    
     
     Dim ADC_Input As Word 
    
    
    Dim avg As Byte
    Dim Side As Float
    Dim round As Byte
    Dim direction As Byte 
    Dim Vane As String
     
     
     
     DelayMS 250                                     
        '---intialize the SPI in Mode 0-----------------
        SMP1   = 0                                      ' Data input sampled at middle of data output time
        CKE1   = 1                                      ' CPHA - transmit on falling edge active to idle 
        CKP1   = 0                                      ' CPOL - idle state is low level
        SSPEN = 1                                      ' Enable SPI  
        '---intialize the LCD---------------------------
        GoSub Init_GLCDST7565                           ' intialize the LCD      
        DelayMS 10
        GoSub GlcdWriteCmd[0xA5]                        ' all points on - black screen  
        DelayMS 500                                      
        GoSub GlcdWriteCmd[0xA4]                        ' normal display
        Cls           
        '---intialize the LCD---------------------------
    
    
    cyccount=1
    cycle=60 
    
    
    
    
    OpenADC(ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_2_TAD, ADC_REF_VDD_VSS, 0b00000010)
    nord=0
    ne=0
    e= 0
    sudest=0
    sud =0
    sw=0
    w=0
    nordw=0 
    direction=0
    
    
    main:
    
    
    
    
    ADC_Input = ReadADC(ADC_CH1) ' Read the ADC from channel AN1
    Select ADC_Input
    
    
    Case 750 To 800
    Side=0
    Case 340 To 430
    Side=22.5
    Case 431 To 530
    Side=45
    Case 75 To 88
    Side=67.5
    Case 89 To 110
    Side=90
    Case 60 To 74
    Side=112.5
    Case 150 To 210
    Side=135
    Case 110 To 149
    Side=157.5
    Case 260 To 340
    Side=180
    Case 210 To 260
    Side=202.5
    Case 615 To 670
    Side=225
    Case 530 To 614
    Side=247.5
    Case 900 To 1000
    Side=270
    Case 800 To 857
    Side=292.5
    Case 858 To 900
    Side=315
    Case 671 To 749
    Side=337.5
     
    EndSelect
    
    
    
    
    round=Side
    
    
    Select round
    Case <22
    nord=nord+1
    If nord>direction Then 
    direction=nord
    Vane="N "
    avg=4
    End If
    
    
    Case 22 To 68
    ne=ne+1
    If ne>direction Then 
    direction=ne
    Vane="NE"
    avg=12
    End If
    
    
    Case 69 To 113
    e=e+1
    If e>direction Then 
    direction=e
    Vane="E "
    avg=20
    End If
    
    
    Case 113 To 158
    sudest=sudest+1
    If sudest>direction Then 
    direction=sudest
    Vane="SE"
    avg=28
    End If
    
    
    Case 159 To 203
    sud=sud+1
    If sud>direction Then 
    direction=sud
    Vane="S "
    avg=36
    End If
    
    
    Case 204 To 248
    sw=sw+1
    If sw>direction Then 
    direction=sw
    Vane="SW"
    avg=44
    End If
    
    
    Case 248 To 293
    w=w+1
    If w>direction Then
    direction=w
    Vane="W "
    avg=52
    End If
    
    
    Case 294 To 338
    nordw=nordw+1
    If nordw>direction Then 
    direction=nordw
    Vane="NW"
    avg=60
    End If
    
    
    EndSelect
    
    
    Print At 7,1,"N "
    Print At 6,1,"NE"
    Print At 5,1,"E "
    Print At 4,1,"SE"
    Print At 3,1,"S "
    Print At 2,1,"SW"
    Print At 1,1,"W "
    Print At 0,1,"NW"
    
    
    Line 1,13,3,13+nord,3
    Line 1,13,11,13+ne,11 
    Line 1,13,19,13+e,19
    Line 1,13,27,13+sudest,27
    Line 1,13,35,13+sud,35
    Line 1,13,43,13+sw,43 
    Line 1,13,51,13+w,51
    Line 1,13,59,13+nordw,59 
    
    
       
    If cyccount = cycle Then
    
    
     Print At 0,80, Str Vane     'more frequent wind direction during 5 minutes          
    
    
    Line 0,13,3,13+nord,3
    Line 0,13,11,13+ne,11 
    Line 0,13,19,13+e,19
    Line 0,13,27,13+sudest,27
    Line 0,13,35,13+sud,35
    Line 0,13,43,13+sw,43 
    Line 0,13,51,13+w,51
    Line 0,13,59,13+nordw,59
    
    
             
     cyccount = 0
                
     nord=0
     ne=0
     e= 0
     sudest=0
     sud =0
     sw=0
     w=0
     nordw=0       
     direction=0             
    End If
    DelayMS 5000
     Inc cyccount  
    GoTo main
    In the meanwhile, and for the moment, as you see in the code above, I used wind vane of PCE-FS 20 weather station of PCE instruments, with an analogue output.
    The routine reads wind direction each 5 s for a total of 5 minutes and found the prevalent direction during that time (graphed in a histogram).

    Not too elegant, my code, but it seems to work.
    I'm going to add it in my little weather station.

    Thank you again.

    Regards

  24. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  25. #13
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,884
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Compiling error on Weather station code

    Nice simple solution Broderic. Glad you solved it.

    John

  26. Attention
    ×

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Assember Error 113 when compiling Scroll_demo.bas ILI9320
    By Mellbreak in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 2nd October 2019, 16:22
  2. [SOLVED !] Program 'USB18 Com_18F26J50' gives compiling error
    By arifcan in forum Absolute Beginners Section
    Replies: 7
    Last Post: 29th February 2016, 08:29
  3. Errors compiling old code
    By geoff_c in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 16th December 2013, 06:35
  4. [SOLVED !] Notepad++: Code Folding & Compiling
    By cgriffin in forum Third Party Support
    Replies: 0
    Last Post: 4th June 2010, 00:29
  5. [SOLVED !] Soldering Station
    By Mark Rodgers in forum The Lounge
    Replies: 22
    Last Post: 4th May 2007, 16:40

Posting Permissions

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