We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
posted on 2014/11/30 03:55:29 PM CET
hi
I'm trying to get an RS232 click board working with a clicker2 board using microbasic.
My code is as as below. I don't get anything out of the serial port. It's just a very simple program to start with to get the 232 click working before I move onto more complex code. Within the code I also have a bit of code to turn on an led when a button is pressed and that all works OK. It's probably something very simple that I've not done but I can't spot it. Have looked at rs232 click examples and can't see what I am missing
Thanks
Paul
program RF_Wind_Monitor_Transmitter
' pin definitions
dim LD1 as sbit at LATD4_bit 'left hand LED
dim LD2 as sbit at LATE4_bit 'right hand LED
dim LD1_Direction as sbit at TRISD4_bit
dim LD2_Direction as sbit at TRISE4_bit
dim T1 as sbit at RD7_bit 'left hand button
dim T2 as sbit at RH3_bit 'right hand button
dim T1_Direction as sbit at TRISD7_bit
dim T2_Direction as sbit at TRISH3_bit
' MCU initialization
sub procedure MCU_Init()
T1_Direction = 1 ' Set direction for buttons
T2_Direction = 1
LD1_Direction = 0 ' Set direction for LEDs
LD2_Direction = 0
LD1 = 0 ' turn off LEDs
LD2 = 0
' Initialize global variables
UART1_Init(9600) ' Initialize UART1 module at 9600 bps
Delay_ms(100) ' Wait for UART1 module to stabilize
UART2_Init(9600) ' Initialize UART2 module at 9600 bps
Delay_ms(100) ' Wait for UART2 module to stabilize
end sub
main:
MCU_Init() ' Initialize the MCU
UART1_Write_Text("EchoTest") ' send text string
UART1_Write(13)
Delay_ms(250) ' wait for 250ms
while(TRUE) ' Endless loop
' check T1 button
if (Button(PORTD, 7, 2, 1)) then ' Detect logical zero
LD1 = 0 'turn on LD1
else
LD1 = 1 ' turn off LED1
end if
wend
end.
posted on 2014/11/19 02:38:15 PM CET
Hi I'm trying to program a ATtiny24 by mikroBASIC using a mikroProg for AVR programer.
can someone send me a sample project it please or help in order to modify some example project for the mine ?
I use the example for the ATmega16 provided for mikroBASIC the micro was programmed but then I lost communication I I feel this damage I put another new micro and this has communication with the mikroProg for AVR.
Thanks.
Francisco,
posted on 2014/11/14 08:42:23 AM CET
posted on 2014/11/10 01:37:04 AM CET
Using USBHost_dsPIC Library and some of the following code, My USB MODEM ENUMERATES...
Could someone help me setup Call Backs to Send AT Commands to Modem?
I have done this with Microchips Generic Host using C Library...
Trying to transition to MikroBasic for this and other functionality.
Thanks
sub procedure USB1Interrupt() iv IVT_ADDR_USB1INTERRUPT
USBHost_IntHandler()
end sub
sub procedure EventHandler(dim event as byte)
select case(event)
case _USB_HOST_EVENT_DEVICE_ADDRESSED
UART2_Write_Text("Host Addressed")
UART2_Write(13)
UART2_Write(10)
case _USB_HOST_EVENT_DEVICE_CONNECTED
UART2_Write_Text("Host Connected")
UART2_Write(13)
UART2_Write(10)
case _USB_HOST_EVENT_DEVICE_DISCONNECTED
UART2_Write_Text("DisConnected")
UART2_Write(13)
UART2_Write(10)
case _USB_HOST_EVENT_DEVICE_ENUMERATED
UART2_Write_Text("Device Enumerated")
UART2_Write(13)
UART2_Write(10)
speed=11
speed = USBHost_GetDeviceSpeed()
USBHost_InitEp(0x02)
if speed = _USB_HOST_SPEED_LOW then
Uart2_Write_Text("The Device is Low Speed")
UART2_Write(13)
UART2_Write(10)
end if
if speed = _USB_HOST_SPEED_FULL then
Uart2_Write_Text("The Device is FULL Speed")
UART2_Write(13)
UART2_Write(10 )
end if
case _USB_HOST_EVENT_HOST_ERROR
UART2_Write_Text("Error")
end select
end sub
USB1IE_bit = 1 ''important set USB interupt bit
USBHost_RegisterDeviceEventHandler(@EventHandler)
USBHost_Init()
while TRUE
' LATB.15 = not LATB.15 ' Invert PORTB value
USBHost_Main(
wend
posted on 2014/11/05 05:18:30 PM CET
Hi,
I am doing a project where I have to connect 2 different bluetooth devices to a PIC. I am going to use the bluetooth click 2 board from Mikroelectronika for prototyping. Could someone point me in the right direction for handling 2 modules. Thank you.