Announcement

Collapse
No announcement yet.

uOLED-160G2 how to create a synchronization signal

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • uOLED-160G2 how to create a synchronization signal

    Hi guys, it's my first time to ask here. I'm using the joystick guide in app note to display different shape of flashing rectangle by adjusting the potentiometer value. It works great. But here comes the problem, I want to add a synchronization signal which with the same flashing frequency of my flashing rectangle (1 Hz). Right now, I only used IO1 pin. Can I add a synchronization signal on IO2 pin? how could I do that? Thanks for your help!

  • #2
    Um, does it need to be syncronised to something external? If not why not use a timer.

    That should be pretty straight forwards, something like

    pin_Set(INPUT, IO2); // set pin to input

    if (pin_Read(PA2)) // if it's high

    endif

    Have you looked at the Goldelox internal functions reference? (hit PF1 when your project is open)
    Mark

    Comment


    • #3
      Originally posted by ESPsupport View Post
      Um, does it need to be syncronised to something external? If not why not use a timer.

      That should be pretty straight forwards, something like

      pin_Set(INPUT, IO2); // set pin to input

      if (pin_Read(PA2)) // if it's high

      endif

      Have you looked at the Goldelox internal functions reference? (hit PF1 when your project is open)

      Thanks for your reply! Yes we need to capture the synchronized signal externally. Can I make the Pin 2 to output 1 Hz signal?

      Comment


      • #4
        Sure, I'd probably just set the pin to output and use a timer, flipping the pin every time it expires. Won't be 1.00000 Hz, but I don't think you need it that accurate
        Mark

        Comment


        • #5
          Originally posted by ESPsupport View Post
          Sure, I'd probably just set the pin to output and use a timer, flipping the pin every time it expires. Won't be 1.00000 Hz, but I don't think you need it that accurate

          I will try it out tomorrow! Thanks!

          Comment


          • #6
            Originally posted by ESPsupport View Post
            Sure, I'd probably just set the pin to output and use a timer, flipping the pin every time it expires. Won't be 1.00000 Hz, but I don't think you need it that accurate

            Hi Mark,
            Could you tell me how to flip the pin? I found the timer in that pdf but doesn't help me that much.


            pin_Set(OUTPUT, IO2); // set pin to input

            *TIMER0 := 1000 ; // set timer to time 1000ms

            if (TIMER0 == 1000)
            pin_HI(IO2);

            endif

            Thanks

            Comment


            • #7
              Something like this will do it

              Code:
              func main()
              
                  pin_Set(OUTPUT, IO2);               // set pin to input
                  *TIMER0 := 1000 ;                   // set timer to time 1000ms
                  repeat
              
                      if (!*TIMER0)                   // timers count down, this will be true when timer has expired
                          if (pin_Read(IO2))          // if high
                              pin_LO(IO2);            // make it low
                          else                        // else
                              pin_HI(IO2);            // make it high
                          endif
                          *TIMER0 := 1000 ;           // reset timer to time 1000ms
                          endif
                  forever
              
              endfunc
              Mark

              Comment

              Working...
              X