CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Communication rf adc
Goto page Previous  1, 2, 3, 4
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Apr 17, 2017 2:51 pm     Reply with quote

Could also just use some of the RN modules (I think the RN-131 comes to mind) from Microchip.

has Analog and GPIO -- all over WiFi (or Bluetooth and I think Xigbee) if you wanted.
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
temtronic



Joined: 01 Jul 2010
Posts: 9093
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Apr 17, 2017 2:59 pm     Reply with quote

Yeesh, I just looked up those rn-131 chips from Digikey.ca....about $50 ! and of course you need some 'other stuff' to make them work...my simple, easy solution is to use HC-12 modules for $6 each, as I pointed out 2 pages ago...once the 'RS232 code is running (PIC to PIC), simply add the HC-12s and the project is finished.

Jay
sergio3214



Joined: 15 Mar 2017
Posts: 25
Location: brasil

View user's profile Send private message

adc via rf
PostPosted: Mon Apr 17, 2017 3:57 pm     Reply with quote

Good night ...
I'll use the HC12 module
But the question is and how can I improve this code to make it work with RS 232 communication? Is open for suggestions.
Code:
#include<16f628a.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Clock <=4Mhz
#FUSES PUT //Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection

#use delay(clock=4000000) // clock internal
#use rs232(baud=9600, xmit=PIN_B2,rcv=PIN_B1)

#define RF_OUTPUT PIN_B1 // O receptor RF é conectado
#define RF_INPUT PIN_B2 // O Transmissor RF é conectado

#define botao_incremento PIN_B0
#define botao_decremento PIN_B4
#define botao_start PIN_A3


#define led_ligado PIN_A2

int cont,ligado,tempo;

void main()
{
setup_ccp1(CCP_OFF);
setup_timer_2(T2_DIV_BY_4,249,1);
setup_vref(FALSE);

ligado=0;
cont=0;
tempo=10;

while (true)
{

// botão start
if ((input(botao_start)) && (ligado==0))
{
output_high(led_ligado);
ligado=1;
while (input(botao_start)){};
delay_ms(tempo);
}

if ((input(botao_start)) && (ligado==1))
{
output_low(led_ligado);
ligado=0;
cont=0;
while (input(botao_start)){};
delay_ms(tempo);
}

// botão incremento
if ((input(botao_incremento)) && (ligado==1))
 {
  if ((cont>=0) && (cont<=249))
   {
    cont++;
   }
  if (cont>=249)
   {
    cont=249;
   }
delay_ms(tempo);
}

// botão decremento
if ((input(botao_decremento) && (ligado==1)))
 {
  if ((cont>=1) && (cont<=249))
   {
    cont--;
   }
  if (cont<=0)
   {
    cont=0;
   }
delay_ms(tempo);
}


// Controle do PWM
if (ligado==1)
 {
  set_pwm1_duty(cont);
 }
if (ligado==0)
 {
  set_pwm1_duty(0);
 }

 }
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group