LOTS of questions....


Closed Thread
Results 1 to 4 of 4
  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.

  2. #2
    Join Date
    Mar 2008
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    oh yeah, most likely using a pic16f88 or pic18f452 (maybe f455?? cant remember...)

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    I'll try a few of them...not all...
    [QUOTE=reaper0995;52956]HPWM 1, DEC dog, 1000[QUOTE]
    No need for DEC in the HPWM line.

    now, lets say i want to get OUT of this while loop WITHOUT modifying the "dog" value, would this work to "force" wend??
    You can jump out of a while/wend loop anytime, without any collateral damage so to speak.
    No stack to mess with or worry about. And you can 'nest' while/wend pairs, just like you can nest for/next loops. Just don't get the while/wend pair inter-twined...

    3: can i invert an ascii character on lcdout, or perhaps with an ede702? preferably on the lcdout....
    No. Generally the character sets are fixed...generally that is! But you can use the graphic character ram to make the characters you need as you need them. Trouble is, you only get 8 (sometimes 16) spots to do that. And if you change one of them, if another character is already displayed, it'll change too.

    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?
    Nope. All of those commands are 'blocking' commands. They'll have to finish before anything else happens.
    If you want to do more than one thing at a time, you'll have to play with the hardware, compare/capture ports, hardware PWM, and interrupts, and so on...

    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??
    A parallel, Hitachi 44780 based LCD, is usually capable of operating in either 4 or 8 bit mode. It's mainly a way to save a few pins. Most of the 4-bit only LCDs I've seen are the 8 character types. 8 bit types are a bit faster, 4 bit types require 2 writes per character sent (high nybble, low nybble, and so on).

    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.
    Can't get to those dots...generally, if it's a standard parallel LCD. You might have a 'special' LCD, but I'd doubt it. I haven't seen one yet.

    Sounds to me almost like you're trying to read the speed of a mouse wheel encoder...or something along those lines. There's methods of doing that, and hardware to do that for you. I can't place any off the top of my head... Maybe somebody else knows...

  4. #4
    Join Date
    Mar 2008
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    I'll try a few of them...not all...
    Sounds to me almost like you're trying to read the speed of a mouse wheel encoder...or something along those lines. There's methods of doing that, and hardware to do that for you. I can't place any off the top of my head... Maybe somebody else knows...
    close, i am trying to do an encoder and motor/gearing from a printer, but i do have a wheel from a mouse just in case the printer one doesnt work (the encoder has a LOT of interupt bars, if more than 255 of them, i cant use it... i will store the last location in the eeprom (so when i turn on/off, i will still know where i was when i left off), and of course eeprom only goes to 255. i kinda want to stay away from "off the shelf" units since they are kinda costly, and i have a fair amount of spare PIC's laying around to tinker with. it there is something i might be able to hack out of (lots of spare crap!), might do that.

    thank you for the fast response!!

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 : 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