Program rests

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
antonadc
Posts: 277
Joined: 14 Dec 2012 10:15
Location: Pretoria South Africa

Program rests

#1 Post by antonadc » 21 Nov 2015 17:32

Hello ME team

I am using a pic32mx130f64b chip reconfigured the rx and tx pins to port b14 and 15. all works great . I wrote the following simple routine to see how it works. At 10 000 the routine resets. Why is that so. Any help will be appreciated. I have even tried it with longword..The crystal I am using is a 20mhz and configured it to 50Mhz divide by 4 multiply 5 divide2

Code: Select all


program Led_Blinking

 dim hold as uint64
 dim holdstr as string[20]

main:
  JTAGEN_bit = 0                     ' Disable JTAG
  ansela=0
  anselb=0
  Unlock_IOLOCK()
  PPS_Mapping(_RPB15, _OUTPUT, _U1TX)' Sets pin PORTB.B2 to be Output and maps UART1 Transmit to it
  PPS_Mapping(_RPB14, _INPUT, _U1RX) ' Sets pin PORTB.B3 to be Input and maps UART1 Receive to it
  Lock_IOLOCK()
  TRISA = 0                          ' Initialize PORTA as output
  TRISB = %0100000000000000          ' Initialize PORTB.b14 as input
  UART1_Init(115200)
  LATA = 0                           ' Set PORTA to zero
  hold = 0
'-------------------------------------------------------------------------------
  while TRUE
    hold=hold+1
    LATA = not PORTA                 ' Invert PORTA value
    Delay_ms(100)
    UART1_Write_Text("Hello World = ")
    uint64tostrwithzeros(hold,holdstr)
    UART1_Write_Text(holdstr)
    UART1_Write_Text(" 100ms")
    UART1_Write(13)
    UART1_Write(10)
  wend
'-------------------------------------------------------------------------------
end.



Thanks

Anton

antonadc
Posts: 277
Joined: 14 Dec 2012 10:15
Location: Pretoria South Africa

Re: Program rests

#2 Post by antonadc » 22 Nov 2015 12:17

Thanks solved watchdog was on.

Anton

Post Reply

Return to “mikroBasic PRO for PIC32 General”