با سلام.
با توجه به Manual میکرو های سری XMEGA، ذکر شده که مثلا اگر میکرو توسط Software Reset، ریست شود، رجیستر RST_status در بیت پنجم مقدارش برابر 1 می شود. یا با ریست شدن در حالت Power_On، رجیستر RST_Status در بیت 0 مقدارش set می شود. اما من کد زیر را نوشتم و بعد از Software_Reset کردن میکرو، رجیستر های مذکور را می خوانم، اما در تمام حالات مقدار 0 برگشت داده می شود. لطفا راهنمایی کنید ایراد کار کجا است.
با تشکر
با توجه به Manual میکرو های سری XMEGA، ذکر شده که مثلا اگر میکرو توسط Software Reset، ریست شود، رجیستر RST_status در بیت پنجم مقدارش برابر 1 می شود. یا با ریست شدن در حالت Power_On، رجیستر RST_Status در بیت 0 مقدارش set می شود. اما من کد زیر را نوشتم و بعد از Software_Reset کردن میکرو، رجیستر های مذکور را می خوانم، اما در تمام حالات مقدار 0 برگشت داده می شود. لطفا راهنمایی کنید ایراد کار کجا است.
با تشکر
کد:
$regfile = "xm128a3udef.dat" $crystal = 50000000 $hwstack = 100 $swstack = 100 $framesize = 100 '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ System OSC & Clock ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '>>>>>> WORKS <<<<<<< 'Try Overclocking for Logic Analyzer Sampling. 'Xmega Max Spec is 32 MHz. 'Incrementally Incr PLL using 2 MHz Int Osc. 'PLL = x16 = 32 MHz = Baseline, in spec. 'Set up the Xmega clock. 'Run on Internal 2 MHz Osc, PLL= x25, Clk = 50 MHz. 'This MANUALLY turns on the Xmega PLL. 'Xmega runs at 2MHz on power up. Osc_ctrl = 15 'All Osc ON, PLL Off Clk_psctrl = 0 'No PreScaler in use Osc_xoscctrl = 195 '12-16MHz, 256 Clks Osc_pllctrl = 25 'PLL: Int 2 MHz Osc x 25 !!! Waitms 3 Osc_ctrl = 31 'PLL ON, All Osc Sources On Waitms 3 Cpu_ccp = 216 'Config Change Protection Clk_ctrl = 4 '4=Use PLL as Clock Source / 1=32MHz internal '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ System OSC & Clock ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ '****************************************************************************** '************************ Config Interrupts & Includes ************************ '****************************************************************************** Config Submode = New Config Priority = Static , Vector = Application , Lo = Enabled 'config interrupts Enable Interrupts '****************************************************************************** '************************ Config Interrupts & Includes ************************ '****************************************************************************** Sw1 Alias Pinf.3 Sw2 Alias Pinf.4 Config Sw1 = Input Config Sw2 = Input Dim Cou1 As Byte Dim Rr As Byte Config Com1 = 9600 , Mode = 0 , Parity = None , Stopbits = 1 , Databits = 8 Open "Com1:" For Binary As #1 'Must Open Com1 Before Printing' Print #1 , "Hello" Print #1 , "Hello" Print #1 , "Hello" Do If Sw1 = 1 Then Waitms 30 If Sw1 = 1 Then Waitms 200 Gosub Sww1 End If End If If Sw2 = 1 Then Waitms 30 If Sw2 = 1 Then Waitms 200 Gosub Sww2 End If End If If Cou1 > 254 Then Cpu_ccp = 216 Rst_ctrl.0 = 1 Else Incr Cou1 End If Waitms 40 Loop Close #1 End Sww1: Print #1 , "RST_Status.5= " ; Rst_status.5 'Software Reset' Print #1 , "RST_Status.0= " ; Rst_status.0 'Power-On Reset' Return End Sww2: Rst_status.5 = 0 Print #1 , "RST_Status.5 return to 0 manually" Return End
دیدگاه