HRSIN woes !


+ Reply to Thread
Results 1 to 4 of 4

Thread: HRSIN woes !4146 days old

  1. #1
    Prolific Poster C_Moore's Avatar
    Join Date
    Sep 2004
    Posts
    1,393
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    704.59 MB

    0 Not allowed!

    Default HRSIN woes !

    Hi everyone,

    I am having some trouble with HRSIN and was hoping some one could put me in the right direction. The code below works except for the fact that I can never get the right value in the var W_COUNT.Mark has given me some pointers in another thread that I had some issues with.I have now determined my trouble is with HRSIN. Whats happening is if I enter say the number 5 I get some outragious number like 3381 .I tried using HRSIN like "w_count = hrsin with no luck and "hrsin dec,w_count with no luck either.Does anyone have any tips they can give me on this.Thanks.

    Code:
    Device = 18F452
      XTAL = 8
      ALL_DIGITAL = 1
      
     ' CREATE_COFF = true
     'setup config fuses
       CONFIG_START
       OSC = HS ; HS
       OSCS = OFF ; Disabled
       PWRT = OFF ; Disabled
       BOR = OFF ; Disabled
       WDT = OFF ; Disabled
       CCP2MUX = OFF ; Disable (RB3)
       STVR = OFF ; Disabled
       LVP = OFF ; Disabled
       Debug = OFF ; Disabled
       CP0 = OFF ; Disabled
       CP1 = OFF ; Disabled
       CP2 = OFF ; Disabled
       CP3 = OFF ; Disabled
       CPB = OFF ; Disabled
       CPD = OFF ; Disabled
       WRT0 = OFF ; Disabled
       WRT1 = OFF ; Disabled
       WRT2 = OFF ; Disabled
       WRT3 = OFF ; Disabled
       WRTB = OFF ; Disabled
       WRTC = OFF ; Disabled
       WRTD = OFF ; Disabled
       EBTR0 = OFF ; Disabled
       EBTR1 = OFF ; Disabled
       EBTR2 = OFF ; Disabled
       EBTR3 = OFF ; Disabled
       EBTRB = OFF ; Disabled
    CONFIG_END
    
      TRISA = 0    'Set Port B to output
      TRISD = 0
      TRISC = %10000000
      
     HSERIAL_BAUD = 19200       ' Set baud rate to 19200
     HSERIAL_RCSTA = %10010000       ' Enable serial port and continuous receive
     HSERIAL_TXSTA = %10100100       ' Enable transmit and asynchronous mode 
     HSERIAL_CLEAR = On         ' Optionally clear the buffer before receiving
    
     
      LCD_RSPIN PORTD.2
      LCD_ENPIN = PORTD.3
      LCD_DTPIN = PORTD.4
      LCD_LINES = 4
      LCD_COMMANDUS 5000
      
    '***********************************'declare vars*********************************************** 
      
      Dim ramp_time As Word      ' controll stepper motor RPM
      Dim step_ As Byte     ' motor step position 
      Dim turn_count As Word ' complete rotations
      Dim w_count As Word     'the desired number of turns 
      Dim rx_byte As Byte    'vars to store serial data
      Dim Tx_byte As Byte     'vars to store serial data
      Symbol step_pos = PORTA   'alias portA
      
      DelayMS 2000       'wait for pic to initialize
      Print At 1,1,"Stepper Test"
     
      DelayMS 1000
      
      
    ;*****************************************************************************************************
       
    '******************************************************************************************************    
    Init:
       'initalize vars
       step_pos = 0
       ramp_time = 30     
       step_ = 0
       turn_count = 0
       w_count =0
       Cls
        
        DelayMS 100                                                                            
       GoTo get_data
       
       
       
       
       
       
        get_data:
           
           HRSin Dec,w_count      ' Number of turns stepper needs to go
          
            Print At 1,1,Dec, w_count  'varify w_count value
            DelayMS 3000
            Cls
            GoTo Start
          
           
           
      ' The below code runs the stepper a preselected amount of rotations.
        ' Depending on what the value of w_count is. 
        
           
     Start:
       
            
             Repeat
             For step_ = 0 To 47 Step 1
             step_pos =  LookUp step_,[1,2,4,8,1,2,4,8,1,2,4,8,1,2,4,8,1,2,4,8,1,2,4,8,1,2,4,8,1,2,4,8,1,2,4,8,1,2,4,8,1,2,4,8,1,2,4,8]
             Print At 1,1,"ramp_time=",Dec, ramp_time, "    "
             Print At 2,1,"w_count=",Dec, w_count, "    "
             DelayMS ramp_time
             Next step_
             Inc turn_count                
             Print At 3,1,"turn_count=", Dec, turn_count, "   "    ' current number of  rotations
             HRSOut Dec,turn_count
             Until turn_count = w_count
             If turn_count = w_count Then    'if counts needed is = to counts wanted then stop
             Low step_pos
             End If
             
       
            GoTo Init
      
      
     End
    Regards
    Charlie M.

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.

  • #2
    Maverick
    Guest Maverick's Avatar

    0 Not allowed!

    Default

    get_data:

    HRSin Dec , w_count ' Number of turns stepper needs to go

    Print At 1,1,Dec, w_count 'varify w_count value
    DelayMS 3000
    Cls
    GoTo Start
    Take out the comma

    get_data:

    HRSin Dec w_count ' Number of turns stepper needs to go

    Print At 1,1,Dec, w_count 'varify w_count value
    DelayMS 3000
    Cls
    GoTo Start
    that should cure the issue (i think) it is certainly a syntax error



    Also just spotted same here "Print At 1,1,Dec, w_count 'varify w_count value" should be "Print At 1,1,Dec w_count 'varify w_count value"

    You don't put a comma after the DEC modifier
    Syntax is DEC VARIABLE not DEC,VARIABLE

  • 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
    Prolific Poster C_Moore's Avatar
    Join Date
    Sep 2004
    Posts
    1,393
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    704.59 MB

    0 Not allowed!

    Default

    Thanks Mav,

    I will do that.I never got a warning or compiler error.Thanks.
    Regards
    Charlie M.

  • 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.

  • #4
    Prolific Poster C_Moore's Avatar
    Join Date
    Sep 2004
    Posts
    1,393
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    704.59 MB

    0 Not allowed!

    Default

    Thanks Mav,

    That seems to have done it.not sure why hrsin dec,w_count (with comma) made the value so far off.Also seems there sould be a compiler error message saying something to the effect of syntax error or something.Thanks again.
    Regards
    Charlie M.

  • 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. Preprocessor woes
      By towlerg in forum Proton Plus Compiler v3
      Replies: 2
      Last Post: 16th April 2018, 00:56
    2. More CData woes
      By RGV250 in forum The Lounge
      Replies: 6
      Last Post: 12th February 2011, 19:30
    3. [SOLVED !] RS232 Woes
      By Whitt in forum Proton Plus Compiler v3
      Replies: 5
      Last Post: 19th October 2006, 19:06
    4. [SOLVED !] Bootloader woes
      By ScottBridges in forum Mecanique - IDE
      Replies: 3
      Last Post: 26th January 2006, 15:37

    Members who have read this thread since 24th November 2019, 19:17 : 0

    Actions :  (Set Date)  (Clear Date)

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

    Tags for this Thread

    Posting Permissions

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