Negative values in freq, R1, C1 in the labels why?

Started by Stephane Fonteyne, September 27, 2013, 07:54:23 AM

Previous topic - Next topic

Stephane Fonteyne

Dear support

I have my first FF3 version using scrollbars and labels. Later I have plan put an graphical picture box and you see the the Curves for Uo and Ui also the phase shift but is that possible in FF3 with using the DDT commands GRAPHIC or better the SDK style with GDI functions?

When I started the project I see negative values?. Is there an solution but that are not the correct results for calculate the Low Pass Filter

Here is my code:

FF_App_Start

#COMPILE Exe "//PROJECT_NAME//.exe"

' #BLOAT <num_expr>
' #COMPILER PBWIN
' #DEBUG ERROR ON|OFF
' #DIM ALL|NONE
' #OPTION {LARGEMEM32 | VERSION3 | VERSION4 | VERSION5 | WIN95 | ANSIAPI}
' #REGISTER {ALL | DEFAULT | NONE}
' #TOOLS [ON|+ | OFF|-]
' #STACK <num_expr>
' #ALIGN <boundary>
' #UNIQUE VAR [ON|OFF]

' FireFly will automatically replace the JOSEINCLUDES token (DO NOT DELETE THIS TOKEN)
//JOSEINCLUDES//

' Place your user defined Declares, Constants, and #Include files below this line. FireFly will not
' parse any of your defined #Include files - it simply includes it in the final generated code.
Macro g_PI = 3.1415926535897932384626433832795#


Module code

Function Acos(ByVal x As Ext) As Ext
    Local PI As Ext
   
    PI = 3.1415926535897932384626433832795
   
    If Abs(x) >= 1 Then
        Beep                                                        'FLAG ERROR
        Exit Function
    End If
   
    Acos = PI / 2 - Atn(x/(Sqr(1 - x * x)))
End Function


The GUI FF3 App


'--------------------------------------------------------------------------------
Function FORM1_BTNCALCULATE_BN_CLICKED ( _
                                       ControlIndex     As Long,  _  ' index in Control Array
                                       hWndForm         As Dword, _  ' handle of Form
                                       hWndControl      As Dword, _  ' handle of Control
                                       idButtonControl  As Long   _  ' identifier of button
                                       ) As Long

End Function


'--------------------------------------------------------------------------------
Function FORM1_TIMER1_WM_TIMER ( _
                               hWndForm      As Dword, _  ' handle of Form
                               wTimerID      As Dword  _  ' the timer identifier
                               ) As Long
    Local sb_freq_pos As Long
    Local sb_freq_min As Long
    Local sb_freq_max As Long
   
    Local sb_R1_pos As Long
    Local sb_R1_min As Long
    Local sb_R1_max As Long
   
    Local sb_C1_pos As Long
    Local sb_C1_min As Long
    Local sb_C1_max As Long
   
   
    Local freq  As Double
    Local uo    As Double
    Local uc    As Double
    Local r     As Double
    Local Xc    As Double
    Local phase As Double
    Local f     As Double
    Local z     As Double
    Local C     As Double
   
   
    sb_freq_pos = FF_ScrollBar_GetPos(HWND_FORM1_HSBFREQ)
    FF_ScrollBar_GetRange(HWND_FORM1_HSBFREQ, VarPtr(sb_freq_min), VarPtr(sb_freq_max))
   
    freq = (sb_freq_max + sb_freq_min) - sb_freq_pos / 10
    uo = 2
   
    sb_R1_pos = FF_ScrollBar_GetPos(HWND_FORM1_HSBR1)
    FF_ScrollBar_GetRange(HWND_FORM1_HSBR1, VarPtr(sb_R1_min), VarPtr(sb_R1_max))
   
    r = ((sb_R1_max + sb_R1_min) - sb_R1_pos) * 1000
   
    sb_C1_pos = FF_ScrollBar_GetPos(HWND_FORM1_HSBC1)
    FF_ScrollBar_GetRange(HWND_FORM1_HSBC1, VarPtr(sb_C1_min), VarPtr(sb_C1_max))
   
    c = ((sb_C1_max + sb_C1_min) - sb_C1_pos) * 10^-08
   
    f = freq  * 1000
   
    Xc = 1 / (2 * g_PI * f * c)
           
    z  = Sqr(r * r + Xc * Xc)
    uc = (uo * Xc) / z
   
    FF_Control_SetText(HWND_FORM1_TXTUOUT, Format$(uc * 100,"##.00") & " mV")
   
    phase = (-Acos(uc / uo)) * 180 / g_PI

End Function



'--------------------------------------------------------------------------------
Function FORM1_HSBFREQ_WM_HSCROLL ( _
                                  ControlIndex  As Long,  _  ' index in Control Array
                                  hWndForm      As Dword, _  ' handle of Form
                                  hWndControl   As Dword, _  ' handle of Control
                                  nScrollCode   As Long,  _  ' scroll bar value
                                  nPosition     As Long   _  ' current scroll bar position
                                  ) As Long
    '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ' BEGIN OF THE DEFAULT SCROLLBAR EVENTS CODE
    '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   
    Local ScrollBarPos  As Dword
    Local si            As SCROLLINFO

    si.cbSize = SizeOf(si)
    si.fMask  = %SIF_All
    '=================================================================
    GetScrollInfo(HWND_FORM1_HSBFREQ, %SB_Ctl, ByVal VarPtr(si))
    '=================================================================

    Select Case nScrollCode
        Case %SB_LINELEFT
            Decr si.nPos
        Case %SB_LINERIGHT
            Incr si.nPos
        Case %SB_ThumbPosition, %SB_THUMBTRACK
            si.nPos = nPosition
        Case %SB_PAGELEFT
            si.nPos -= si.nPage
        Case %SB_PAGERIGHT
            si.nPos += si.nPage
    End Select

    '=================================================================
    SetScrollInfo(HWND_FORM1_HSBFREQ, %SB_Ctl, ByVal VarPtr(si), %TRUE)
    '=================================================================
   
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ' END OF THE DEFAULT SCROLLBAR EVENTS CODE
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   
    '================================================================='
    'Gebruikerscode                                                   
    '================================================================='
    Local hsb_f_min As Long
    Local hsb_f_max As Long
    Local hsb_f_pos As Long
   
    FF_ScrollBar_GetRange(HWND_FORM1_HSBFREQ, VarPtr(hsb_f_min), VarPtr(hsb_f_max))
    hsb_f_pos = FF_ScrollBar_GetPos(HWND_FORM1_HSBFREQ)
   
    FF_Control_SetText(HWND_FORM1_TXTFREQ, "f=" & Format$(((hsb_f_max + hsb_f_min) - hsb_f_pos) / 10,"##.00") & " kHz")
   
   
End Function

'--------------------------------------------------------------------------------
Function FORM1_HSBR1_WM_HSCROLL ( _
                                ControlIndex  As Long,  _  ' index in Control Array
                                hWndForm      As Dword, _  ' handle of Form
                                hWndControl   As Dword, _  ' handle of Control
                                nScrollCode   As Long,  _  ' scroll bar value
                                nPosition     As Long   _  ' current scroll bar position
                                ) As Long
   
    '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ' BEGIN OF THE DEFAULT SCROLLBAR EVENTS CODE
    '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   
    Local ScrollBarPos  As Dword
    Local si            As SCROLLINFO

    si.cbSize = SizeOf(si)
    si.fMask  = %SIF_All
    '=================================================================
    GetScrollInfo(HWND_FORM1_HSBR1, %SB_Ctl, ByVal VarPtr(si))
    '=================================================================

    Select Case nScrollCode
        Case %SB_LINELEFT
            Decr si.nPos
        Case %SB_LINERIGHT
            Incr si.nPos
        Case %SB_ThumbPosition, %SB_THUMBTRACK
            si.nPos = nPosition
        Case %SB_PAGELEFT
            si.nPos -= si.nPage
        Case %SB_PAGERIGHT
            si.nPos += si.nPage
    End Select
   
    '=================================================================
    SetScrollInfo(HWND_FORM1_HSBR1, %SB_Ctl, ByVal VarPtr(si), %TRUE)
    '=================================================================
   
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ' END OF THE DEFAULT SCROLLBAR EVENTS CODE
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   
   
    '================================================================='
    'Gebruikerscode
    '================================================================='
    Local hsb_R1_min As Long
    Local hsb_R1_max As Long
    Local hsb_R1_pos As Long
   
    FF_ScrollBar_GetRange(HWND_FORM1_HSBR1, VarPtr(hsb_R1_min), VarPtr(hsb_R1_max))
    hsb_R1_pos = FF_ScrollBar_GetPos(HWND_FORM1_HSBR1)
   
    FF_Control_SetText(HWND_FORM1_TXTR1, "R1= " & Format$(((hsb_R1_max + hsb_R1_min) - hsb_R1_pos) / 1,"##.00") & " k")
End Function


'--------------------------------------------------------------------------------
Function FORM1_HSBC1_WM_HSCROLL ( _
                                ControlIndex  As Long,  _  ' index in Control Array
                                hWndForm      As Dword, _  ' handle of Form
                                hWndControl   As Dword, _  ' handle of Control
                                nScrollCode   As Long,  _  ' scroll bar value
                                nPosition     As Long   _  ' current scroll bar position
                                ) As Long
   
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ' BEGIN OF THE DEFAULT SCROLLBAR EVENTS CODE
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   
    Local ScrollBarPos  As Dword
    Local si            As SCROLLINFO

    si.cbSize = SizeOf(si)
    si.fMask  = %SIF_All
    '=========================================================
    GetScrollInfo(HWND_FORM1_HSBC1, %SB_Ctl, ByVal VarPtr(si))
    '=========================================================
   
    Select Case nScrollCode
        Case %SB_LINELEFT
            Decr si.nPos
        Case %SB_LINERIGHT
            Incr si.nPos
        Case %SB_ThumbPosition, %SB_THUMBTRACK
            si.nPos = nPosition
        Case %SB_PAGELEFT
            si.nPos -= si.nPage
        Case %SB_PAGERIGHT
            si.nPos += si.nPage
    End Select
 
    '=================================================================
    SetScrollInfo(HWND_FORM1_HSBC1, %SB_Ctl, ByVal VarPtr(si), %TRUE)
    '=================================================================
   
    '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ' END OF THE DEFAULT SCROLLBAR EVENTS CODE
    '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

   
    '================================================================================'
    'Gebruikerscode
    '================================================================================'
    Local hsb_C1_min As Long
    Local hsb_C1_max As Long
    Local hsb_C1_pos As Long
   
    FF_ScrollBar_GetRange(HWND_FORM1_HSBC1, VarPtr(hsb_C1_min), VarPtr(hsb_C1_max))
    hsb_C1_pos = FF_ScrollBar_GetPos(HWND_FORM1_HSBC1)
   
    FF_Control_SetText(HWND_FORM1_TXTC1, "C1= " & Format$(((hsb_C1_max + hsb_C1_min) - hsb_C1_pos) / 100,"##.00") & " µF")

End Function


'--------------------------------------------------------------------------------
Function FORM1_TXTC1_STN_CLICKED ( _
                                 ControlIndex     As Long,  _  ' index in Control Array
                                 hWndForm         As Dword, _  ' handle of Form
                                 hWndControl      As Dword, _  ' handle of Control
                                 idStaticControl  As Long   _  ' identifier of static control
                                 ) As Long

End Function


Can someone help me how that fixed this problem

Kind regards
Stephane
Stephane Fonteyne
Ba. Elektronica - ICT
GSM : +32-xxxxxxxxxx
PowerBasic Developer & Hardware Support

Elias Montoya

 You are more likely to get help if you post a complete project... as it is, one has to figure out a lot of stuff just to test your code.

Firefly is an SDK designer, so i suggest you stick to GDI functions. DDT might work, but mixing is not a good idea.

You are probably seeing negative numbers because you dont know much programming (sorry, NOT trying to be rude), i believe the logic of the program is NOT correct. There are a bunch of lose screws, for example, why are you using this line?

phase = (-Acos(uc / uo)) * 180 / g_PI

I mean... it is a LOCAL variable being changed right before the FUNCTION ends... and it is not even a function parameter what will return anything.

I suggest you to get away from computer, think the logic flow of your code and then program it. If you start trying to figure out adding more and more code, in the end you will not know even what code parts are the working ones and it will be an even worse mess.

Just my 2 cents.
Win7, iMac x64 Retina display 5K, i7-5820K 4.4 ghz, 32GB RAM, All updates applied. - Firefly 3.70.

Stephane Fonteyne

Quote from: Elias Montoya on September 27, 2013, 10:04:26 PM
You are more likely to get help if you post a complete project... as it is, one has to figure out a lot of stuff just to test your code.

Firefly is an SDK designer, so i suggest you stick to GDI functions. DDT might work, but mixing is not a good idea.

You are probably seeing negative numbers because you dont know much programming (sorry, NOT trying to be rude), i believe the logic of the program is NOT correct. There are a bunch of lose screws, for example, why are you using this line?

phase = (-Acos(uc / uo)) * 180 / g_PI

I mean... it is a LOCAL variable being changed right before the FUNCTION ends... and it is not even a function parameter what will return anything.

I suggest you to get away from computer, think the logic flow of your code and then program it. If you start trying to figure out adding more and more code, in the end you will not know even what code parts are the working ones and it will be an even worse mess.

Just my 2 cents.

What variabele can I do use then static?. The function is outside the forms in FF3 is that the wrong place. Where can I put the function then in FF3 project
I don't understand what you mean.
Stephane Fonteyne
Ba. Elektronica - ICT
GSM : +32-xxxxxxxxxx
PowerBasic Developer & Hardware Support

Joerg B.

Hello Stephane

You are more likely to get help if you post a complete project... as it is, one has to figure out a lot of stuff just to test your code.

Elias has right. Please post the whole code.

Or hang a zip file to your post.
No one wants to use the crystal ball. :)
Greeting from Germany

Joerg

Stephane Fonteyne

Quote from: Joerg Buckel on September 28, 2013, 02:54:59 PM
Hello Stephane

You are more likely to get help if you post a complete project... as it is, one has to figure out a lot of stuff just to test your code.

Elias has right. Please post the whole code.

Or hang a zip file to your post.
No one wants to use the crystal ball. :)

Hi,

Here are my project zip file with the screenshot

Kind regards
Stephane
Stephane Fonteyne
Ba. Elektronica - ICT
GSM : +32-xxxxxxxxxx
PowerBasic Developer & Hardware Support

Stephane Fonteyne

Hi all,

I've tried everything but can not get away that negative values. Can anyone give the solution how that eliminates?

I've been waiting a long time for a solution

Thanks
Stephane
Stephane Fonteyne
Ba. Elektronica - ICT
GSM : +32-xxxxxxxxxx
PowerBasic Developer & Hardware Support

Elias Montoya

Hello Stephane,

  • You have not tried everything otherwise you would have tried the correct way.
  • You are not supposed to wait. Keep working in your own code because nobody will understand it as good as you.
  • The error explanation is very vague. Which value is negative? Which value should be positive? The result? one of the three variables? What do you mean by negative... sub zero? wrong?
I have attached a sample of your code without negative numbers, but to be honest i doubt this is what you need.
Win7, iMac x64 Retina display 5K, i7-5820K 4.4 ghz, 32GB RAM, All updates applied. - Firefly 3.70.

Wilko Verweij

Dear Stephane,
What is exactly the problem? If I understand your program, you are using the scrollbars to set three values and display them on the right. Are those values OK?
Next step is calculation of a result. Is the result OK? Can you give the formula (mathematical, not in program language) so that we can check the line?

What are you using 'phase' for? You calculate it but do nothing with it.

Regards
Wilko

Stephane Fonteyne

Quote from: Elias Montoya on October 01, 2013, 06:22:14 AM
Hello Stephane,

  • You have not tried everything otherwise you would have tried the correct way.
  • You are not supposed to wait. Keep working in your own code because nobody will understand it as good as you.
  • The error explanation is very vague. Which value is negative? Which value should be positive? The result? one of the three variables? What do you mean by negative... sub zero? wrong?
I have attached a sample of your code without negative numbers, but to be honest i doubt this is what you need.

Thanks Elias,

Now to look how I can drawing the graphical curve as output.

Kind regards
Stephane
Stephane Fonteyne
Ba. Elektronica - ICT
GSM : +32-xxxxxxxxxx
PowerBasic Developer & Hardware Support

Stephane Fonteyne

Quote from: Wilko Verweij on October 01, 2013, 08:19:58 AM
Dear Stephane,
What is exactly the problem? If I understand your program, you are using the scrollbars to set three values and display them on the right. Are those values OK?
Next step is calculation of a result. Is the result OK? Can you give the formula (mathematical, not in program language) so that we can check the line?

What are you using 'phase' for? You calculate it but do nothing with it.

Regards
Wilko

Hi,

The objective of this application. The simulation of a low-pass filter.
I would like to add an graphical presentation in the form of an curve so you can see the amplitude and the phase shift a graph.

If you can help me I would be very grateful. I have vb.net code and wants to develop in FF3 and PB

This are the original link written in vb.net. I try to translated in FF3 with PBWin10.

The application displays only the output voltage in a text box. I would like to present it in a graphic box and drawing the curves That the user can be chooice ampitude and phase shift

This is the screenshot example what I want


This is the link of the vb.net application and the code
http://fkainka.de/vbnet/Tiefpass.html

This code I try to translated but it fails:
From : VBNET

Private Sub ZeichnenSin(ByVal f As Double, ByVal u0 As Integer, ByVal umax As Double, ByVal dime As Double, ByVal phase As Double)
        Dim xvt, i, ut
        'Gitter zeichnen
        If pixelx = 0 Then

            For i = 0 To 14
                For j = 0 To 11
                    pSet(5 + (i * 10), (j * 10) + 5)
                Next j
            Next i
            pSet(0, pixely)
        End If
        'X Koordinaten +1, mit Reset
        pixelx = pixelx + 2
        If pixelx >= 150 Then
            PictureBox1.Image = Nothing
            pixelx = 0
        End If
        'Zeit des Sinus
        'Herzangabe Frequenz bei Timer = 20ms
        vt = vt + (7.2 * f)
        If vt >= 361 Then vt = 0
        xvt = Math.PI * ((vt + phase) / 180.0)
        'Ut kurz vor Ausgabe. UV muss berechnet werden
        ut = u0 + (Math.Sin(xvt)) * umax

        pixely = 115 - ut * (10 / dime)  '*20 denn 1v = 2 Kästchen
        If pixely > 115 Then pixely = 115
        If pixely < 5 Then pixely = 5
        Line(pixelx, pixely)
    End Sub

    Private Sub ZeichnenSinb(ByVal f As Double, ByVal u0 As Integer, ByVal umax As Double, ByVal dime As Double, ByVal phase As Double)
        Dim xvtb, ut
        'X Koordinaten  +2
        pixelxb = pixelxb + 2
        If pixelxb >= 150 Then
            PictureBox1.Image = Nothing
            pixelxb = 0
        End If

        'Herzangabe Frequenz bei Timer = 20ms
        vtb = vtb + (7.2 * f)
        If vtb >= 361 Then vtb = 0
        xvtb = Math.PI * ((vtb + phase) / 180.0)
        ut = u0 + (Math.Sin(xvtb)) * umax

        pixelyb = 115 - ut * (10 / dime)  '*20 denn 1v = 2 Kästchen
        If pixelyb > 115 Then pixelyb = 115
        If pixelyb < 5 Then pixelyb = 5
        Line2(pixelxb, pixelyb)

    End Sub


To : PBWin
=======


Global g_pixel_x    As Single
Global g_pixel_y    As Single
Global g_pixel_xb   As Single
Global g_pixel_yb   As Single
Global vt           As Single
Global vtb          As Single

Sub ZeichnenSin(ByVal f As Double, ByVal u0 As Integer, ByVal umax As Double, ByVal dime As Double, ByVal phase As Double)
    Local xvt As Double
    Local i   As Long
    Local j   As Long
    Local ut  As Double

    'Gitter zeichnen
    If g_pixel_x = 0 Then
        For i = 0 To 14
            For j = 0 To 11
                    Graphic Set Pixel 5 + (i * 10), (j * 10) + 5)
            Next j
        Next i
        Graphic Set Pixel (0, g_pixel_y)
    End If

    'X Koordinaten +1, mit Reset
    g_pixel_x = g_pixel_x + 2
    If g_pixelx >= 150 Then
        'PictureBox1.Image = Nothing
        g_pixel_x = 0
    End If

    'Zeit des Sinus
    'Herzangabe Frequenz bei Timer = 20ms
    vt = vt + (7.2 * f)
    If vt >= 361 Then vt = 0
    xvt = 3.14159 * ((vt + phase) / 180.0)
    'Ut kurz vor Ausgabe. UV muss berechnet werden
    ut = u0 + Sin(xvt)) * umax

    g_pixel_y = 115 - ut * (10 / dime)  '*20 denn 1v = 2 Kästchen
    If g_pixel_y > 115 Then g_pixel_y = 115
    If g_pixel_y < 5 Then g_pixel_y = 5
    'Line(pixelx, pixely)
    'How in PB with GRAPHIC lINE?
End Sub

Sub ZeichnenSinb(ByVal f As Double, ByVal u0 As Integer, ByVal umax As Double, ByVal dime As Double, ByVal phase As Double)
    Local xvtb As Double
    Local ut   As Double

    'X Koordinaten  +2
    g_pixel_xb = g_pixel_xb + 2
    If g_pixel_xb >= 150 Then
        'PictureBox1.Image = Nothing
        g_pixel_xb = 0
    End If

    'Herzangabe Frequenz bei Timer = 20ms
    vtb = vtb + (7.2 * f)
    If vtb >= 361 Then vtb = 0
    xvt = 3.14159 * ((vtb + phase) / 180.0)
    ut = u0 + Sin(xvtb)) * umax

    g_pixel_yb = 115 - ut * (10 / dime)  '*20 denn 1v = 2 Kästchen
    If g_pixel_yb > 115 Then g_pixel_yb = 115
    If g_pixel_yb < 5 Then g_pixel_yb = 5
    'Line2(pixelxb, pixelyb)
End Sub


Kind regards





Stephane Fonteyne
Ba. Elektronica - ICT
GSM : +32-xxxxxxxxxx
PowerBasic Developer & Hardware Support

Elias Montoya

 Hello Stephane,

Im glad my code helped. Now i see what is happening. :)

You know little programming, yet, you go on the adventure not only of understanding someone else's source code but also to translate it... it is very bold. :P

In that case, kudos, go on an crunch it hard, your guesses are as good as mine. :)

I dont know what a low-pass filter is, otherwise i could be of more help.
Win7, iMac x64 Retina display 5K, i7-5820K 4.4 ghz, 32GB RAM, All updates applied. - Firefly 3.70.

Wilko Verweij

Stephane,
Maybe you can come back to  what you wrote about Screenshot_Calculate_LPF.jpg
My questions were about that screenshot. If you explain what you want, maybe we can help you,
Wilko

Stephane Fonteyne

Quote from: Wilko Verweij on October 01, 2013, 04:29:33 PM
Stephane,
Maybe you can come back to  what you wrote about Screenshot_Calculate_LPF.jpg
My questions were about that screenshot. If you explain what you want, maybe we can help you,
Wilko

Wilko,

Goal : Graphic presentation of the output and the input voltage on a graph. A low pass filter allows low frequency by (high amplitude) as the frequency decreases the amplitude higher

You can read what an Low Pass Filter is (LPF)
http://fkainka.de/vbnet/Tiefpass.html
http://www.youtube.com/watch?v=t3Ab9oDjaxE
http://en.wikipedia.org/wiki/Low-pass_filter

Can you help me for presentation the graph.

Kind regards
Stephane




Stephane Fonteyne
Ba. Elektronica - ICT
GSM : +32-xxxxxxxxxx
PowerBasic Developer & Hardware Support