pdf-icon

UIFlow Guide

UiFlow1 Blockly

Event

Unit

UiFlow1 Project

Unit RFID-UHF

Example

Realize the complete process of label reading and data locking

from m5stack import *
from m5ui import *
from uiflow import *
import unit

setScreenColor(0x222222)
uhf_rfid_0 = unit.get(unit.UHF_RFID, unit.PORTC)

epc_no = None

uhf_rfid_0.set_region(uhf_rfid_0.REGIN_CN_800MHZ)
uhf_rfid_0.automatic_freq_hopping(0x00)
print(uhf_rfid_0.get_region())
print(uhf_rfid_0.get_channel_freq())
epc_no = 0
while not epc_no:
  epc_no = uhf_rfid_0.single_polling()
print(epc_no)
while not (uhf_rfid_0.select_tag_param(epc_no)):
  pass
print(uhf_rfid_0.get_select_tag_param())
epc_no = 0
while not epc_no:
  epc_no = uhf_rfid_0.read_memory_bank(2, 2, 0x00, 'FFFF3333')
print(epc_no[0])
print(epc_no[1])
epc_no = 0
while not epc_no:
  epc_no = uhf_rfid_0.lock_data_store(0, 2, 2, 0, 0, 0, 1, 1, 0, 0, 'FFFF3333')
print('Lock Success')

API

uhf_rfid_0.uart_port_id(1)
  • UART Interface Initialization
uhf_rfid_0.automatic_freq_hopping(0xFF)
  • Module Automatic Frequency Hopping
print((str('freq:') + str((uhf_rfid_0.get_channel_freq()))))
  • Get Module Channel Frequency
print((str('info:') + str((uhf_rfid_0.get_device_info(0x00)))))
  • Get Module Device Information
print((str('code:') + str((uhf_rfid_0.get_region()))))
  • Get Module Operating Region
print((str('tag:') + str((uhf_rfid_0.get_select_tag_param()))))
  • Get Module Card Selection Parameters
print((str('tx:') + str((uhf_rfid_0.get_tx_power()))))
  • Get Module Transmit Power
print(uhf_rfid_0.lock_data_store(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ''))
  • Lock Module Data Storage Area
uhf_rfid_0.multiple_polling_stop()
  • Stop Module Multi-Tag Polling
def uhf_rfid_eQuAncb(epc_no, dBm):
  global EPC1, dBm1
  EPC1 = epc_no
  dBm1 = dBm
  pass


print(uhf_rfid_0.multiple_polling_read(uhf_rfid_eQuAncb, 100))
  • Module Multi-Tag Read Count
print(uhf_rfid_0.read_memory_bank(0, 0, 0x00, ''))
  • Read Module Memory Data
uhf_rfid_0.set_channel_freq(920.375)
  • Set Module Channel Frequency
uhf_rfid_0.set_region(uhf_rfid_0.REGIN_CN_900MHZ)
  • Set Module Operating Region
uhf_rfid_0.set_select_mode(0x00)
  • Set Module Card Selection Mode
print((str('param:') + str((uhf_rfid_0.select_tag_param('EPC')))))
  • Set Module Card Selection
uhf_rfid_0.set_tx_power(0)
  • Set Module Transmit Power
print((str('reading:') + str((uhf_rfid_0.single_polling()))))
  • Module Single-Tag Polling
uhf_rfid_0.sleep()
  • Module Enter Sleep Mode
uhf_rfid_0.wakeup()
  • Wake Up Module
print((str('list:') + str((uhf_rfid_0.write_customer_command([0, 0, 0], True)))))
  • Write Custom Command to Module
print(uhf_rfid_0.write_memory_bank('', 0, 0x00, ''))
  • Write Data to Module Memory
On This Page