Файл CC2500 FREQHOPING.bas — различия между версиями

Материал из roboforum.ru Wiki
Перейти к: навигация, поиск
(Новая: <source lang="vb"> $prog &HFF , &HAE , &HD7 , &H00 $regfile = "m8def.dat" $crystal = 8000000 $baud = 19200 $hwstack = 64 $swstack = 32 Print "MEGA START" Config Pinc.0 = Output : Led ...)
 
(нет различий)

Текущая версия на 07:18, 29 июня 2008

<source lang="vb">

$prog &HFF , &HAE , &HD7 , &H00 $regfile = "m8def.dat" $crystal = 8000000 $baud = 19200 $hwstack = 64 $swstack = 32

Print "MEGA START"

Config Pinc.0 = Output : Led Alias Portc.0 : Led = 1 Config Pinb.1 = Output : Zb_cs Alias Portb.1 : Zb_cs = 1 Config Pind.2 = Input : Gdo2 Alias Pind.2 Config Pind.3 = Input : Gdo0 Alias Pind.3 Config Pinb.5 = Output : Zb_sck Alias Portb.5 : Zb_sck = 0 Config Pinb.4 = Input : Zb_miso Alias Pinb.4 Config Pinb.3 = Output : Zb_mosi Alias Portb.3 : Zb_mosi = 0

Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Clockrate = 128 , Polarity = Low , Phase = 0 Spiinit

$include "settings\MSK500RX.bas" $include "include\cc2500.bas"

On Int1 Gdo0_int1 Config Int1 = Falling Enable Int1

Dim I As Byte Dim Recvstat As Byte

Print Chr(10) ; Chr(13) ; "THIS IS USED FOR FREQUENCY HOPING. ONLY RX MODE!" Call Cc_spi_send_strobe(ccxxx0_srx)

Dim Tmp_byte As Byte

Disable Interrupts

Do

  Wait 1
  Led = 0
  Recvstat = Cc_rf_receive_packet()
  Led = 1
  If Recvstat = 1 Then
     Print Str(cc_recv_buffer(1)) ; " bytes : " ; Str(cc_rssi)
  Else
     Call Cc_spi_send_strobe(ccxxx0_srx)
  End If

Loop

Gdo0_int1:

  Disable Interrupts
  Led = 0
  Waitms 500
  Recvstat = Cc_rf_receive_packet_int06()
  If Recvstat = 1 Then
     Print Str(cc_recv_buffer(1)) ; " bytes : " ; Str(cc_rssi)
  Else
     Call Cc_spi_send_strobe(ccxxx0_srx)
  End If
  Led = 1
  Enable Interrupts

Return


</source>