LOTS of questions....


Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Mar 2008
    Posts
    9

    Default LOTS of questions....

    1: can i do this (below)-

    dog var word

    HPWM 1, DEC dog, 1000


    i want the value of my variable to be sent, this is a value for the duty cycle, but i want duty cycle to vary with respest to something else....

    2: lets say i have a "while" statement, and it is like this:

    while (dog == 1)


    wend


    now, lets say i want to get OUT of this while loop WITHOUT modifying the "dog" value, would this work to "force" wend??

    Code:
    while (dog == 1)                                     'while #1
    
          if (cat == 3 )
          wend                                              'wend #2
          while (SOMETHING to go here.....)       'while #2
          endif
    
    wend                                                     'wend #1
    [/QUOTE]

    my logic is that this would "force" the while to end (wend), since its inside another set of operations, then another while to cancel the bottom wend statement..... so NORMALLY the while #1 and wend #1 would make the "while loop" so-to-speak. but in the case the of the "IF," the while #1 would be (force) ended by wend #2, and while #2 would then cancel out wend #1.....

    -normal
    while #1 --> wend #1 (while/wend #2 would not be used)
    -special "IF"
    while #1 --> wend #2, while #2 --> wend #1


    WHY??? i am setting my code based on "states." i have a "master" variable that guides a menu, and if statements decide which sub-menu to go to... like "IF (lcd_state == 1) THEN" means main menu, and so on. i have whiles inside these if's to hold that state (probably could remove the if's, but i like the stability...), and i sometimes need to be able to leave the while-loop to do something, but come back...


    3: can i invert an ascii character on lcdout, or perhaps with an ede702? preferably on the lcdout....



    4: how can i do a pulsin, rctime, or something to count a period (or part of duty cycle, ANYTHING!!), while at the SAME time waiting for counts?

    -what i have is an encoder, and i want to tell position as well as speed.... on one pic IF possible.... i think i can use pulsin or rctime, but then i have to wait in the stack for a pulse to come through to count, and then add the value or what not to the count, then wait again. i am trying to setup a PID (simple...) setup, and i need to keep track of where i am, as well as how fast is the system changing (time between counts).

    -my best SOLUTION to the problem would be to use 2 pics, and have one read JUST pulsin. then this would send info to the 2nd pic. the 2nd pic would have an hserin to collect the data, and after it registers a new count, it goes to check the value of the period that was stored in the hserin. then it does some math, figures out an hpwm (also need above question answered to see if this part would work... hince the change in duty cycles) and sets it and goes back to the count.


    [would have 2 photo interupts to tell direction]

    Code:
    encoder_count   var byte
    encoa               var porta.X   'encoder photo interupt a
    encob               var porta.X   'encoder photo interupt b
    period_time        var byte
    
    
    IF (ENCOA == 0 AND ENCOB == 0) THEN
    WHILE (ENCOA == 0 AND ENCOB == 0)
    	IF (ENCOA == 0 AND ENCOB == 1) THEN
    	ENCODER_COUNT = ENCODER_COUNT + 1
    	ENDIF
    	
    	IF (ENCOA == 1 AND ENCOB == 0) THEN
    	ENCODER_COUNT = ENCODER_COUNT - 1
    	ENDIF
    WEND
    WRITE 1, ENCODER_COUNT
    
    GOSUB CHECK_TIME
    GOSUB ENCODER_PID
    ENDIF
    
    '-----go subs------
    
    check_time:
    hserin  [B0, dec period_time]
    [/QUOTE]


    5: on a normal 14 or 16 pin lcd, there is data 0-7, but 4-7 is all that i can tell gets used.... now i know that the data 0-3 is for SOMETHING, and i am sure the datasheet says why, but hell if i can figure out what they are good for! what are they for? things FAR beyond normal lcd uses??


    6: on a 2x16 lcd, there are charactors 'dots' between the blocked character boxes, and i cant really figure how to use them... and the "dots" between the rows. i would think that "lcdout $fe, $3f" would allow the use of the dot next to the like made by $1f (1f=11111, 3f=111111), lcdout does 5 dots, so this would take the sixth...? but still no idea on the dots between the rows.... my goal is a complete "dot matrix" style graphic without grid lines cutting it up.


    thanks!!
    -james (aka "that new guy")
    Last edited by reaper0995; - 22nd March 2008 at 04:35.

Similar Threads

  1. A few 12F683 questions
    By dhouston in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 24th May 2008, 03:54
  2. Usart Questions
    By shawn in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2008, 01:17
  3. Error when compiling- New user lots of questions
    By Hylan in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 3rd October 2007, 14:35
  4. Still new to PicBasic - i2c questions
    By cometboy in forum mel PIC BASIC
    Replies: 4
    Last Post: - 13th November 2006, 18:27
  5. Hi Everyone! Some newbie questions :-)
    By guest_05 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th October 2006, 22:24

Members who have read this thread : 0

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