Easypic fusion v7 DSPIC33EP512MU810 BLE3Clic

General discussion on mikroC PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Luche
Posts: 3
Joined: 12 Feb 2018 16:20

Easypic fusion v7 DSPIC33EP512MU810 BLE3Clic

#1 Post by Luche » 07 Jun 2018 16:03

Hello to all

I'm developing a project where I have to transmit strings of data, the data is the instant in which the data is generated, from the microcontroller to the pc.

I have an easyPIC Fusion v7 development board,
MCU: dsPIC33EP512MU810
the BLE3 Click trasmission module,
the RTC5 Click time module.

Because im new and i saw it is not simple , i prefer to start to config the Ble3 module, and after i understand how to make it work try with RTC5.

Im using mikroC PRO for dsPIC30/33 and PIC24 v 7.1.0


My first my first doubts are on the project

Image
http://prntscr.com/js44zy

I dont have a guide about this, so i check configurations parameters of other projects

the other big problem
is the ble code

Code: Select all

#include <stdint.h>


/* NOTE: example is utilized by running the BLE Scanner application on a smartphone or tablet
 * BLE Scanner can be found here:
 * https://play.google.com/store/apps/details?id=com.macdom.ble.blescanner&hl=en
 *
 * The MCU will update the status of a port and send it over BLE
 * The value of the port can be found in BLE scanner after connecting to the device
 * under "Custom service", first custom characteristic ( UUID of the characteristic ends with "703" )
 * You can also set the value of PORT over your smartphone/tablet, by writing to the characteristic
 * Make sure that the notifications are enabled in your BLE3 Scanner application
 */


sbit BLE3_CTS_MCU_DIR at TRISB0_bit;
sbit BLE3_CTS_MCU at LATB0_bit;

sbit BLE3_RTS_MCU_DIR at  RE0_bit;
sbit BLE3_RTS_MCU at  TRISE0_bit;

sbit BLE3_RST_DIR at   TRISE1_bit;
sbit BLE3_RST at   LATE1_bit;

uint8_t portd_read = 0;

void main()
{
     ANSELE = ANSELB = ANSELC = ANSELD = 0;
     TRISD = 0;

     BLE3_RTS_MCU_DIR = 0;
     BLE3_CTS_MCU_DIR = 1;
     BLE3_RST_DIR = 0;

     Uart1_Init(115200);        // Initalize UART
     delay_ms(500);

     BLE3_RTS_MCU = 0;          // set RTS pin to 0
     BLE3_RST = 1;              // pull reset pin high
     delay_ms(2000);

     Uart1_Write_Text("AT+UBTLN=");   // set the device name to "mikroE"
     Uart1_Write_Text("\"mikroE\"");
     Uart1_Write_Text("\r");
     delay_ms(1000);

     Uart1_Write_Text("ATO1\r"); // set BLE 3 into data mode, all bytes sent from UART will be sent over BLE
     delay_ms(1000);             // all bytes received from BLE will be sent to UART

     RC1IE_bit = 1;              // set up UART interrupt
     RC1IF_bit = 0;
     PEIE_bit  = 1;
     GIE_bit   = 1;

     while(1)
     {
        LATD = portd_read;
        Uart1_Write(portd_read);   // send the updated value of the port over BLE
        delay_ms(1000);
        portd_read++;
     }

}

// if smartphone/tablet writes to BLE 3, update the port with the value sent from the smartphone/tablet

void interrupt()
{
   if( RC1IF_bit == 1 )
   {
     LATD = UART1_Read();
     portd_read = PORTD;
   }
}


Because im mounting the ble3 module in the first mikrobus socket

i found the pin CTS that shoul be connected to INT/RE8
should i use the PPS_mapping function

Code: Select all

  PPS_Mapping(188, ???,  ???);              // Sets pin RP188 to be ??? , and maps CTS to it
I s the same for RST ?

I stop asking now, and try to solve step by step

I really appreciate for any help and comment.

Thank you in advance

Post Reply

Return to “mikroC PRO for dsPIC30/33 and PIC24 General”