Serial data transmission period


Results 1 to 11 of 11

Threaded View

  1. #1
    Join Date
    Oct 2009
    Posts
    583

    Default Serial data transmission period

    Guys,

    Need some advice for a bit of crude dirty code to send the time and temperature out via serial port.

    Code:
    main:
                          
        OWOUT TEMPIN,1,[$CC,$44]
        OWOUT TEMPIN,1,[$CC,$BE]   
        OWIN TEMPIN,0,[TempT.LowByte,TEMPT.HighByte] 
        TempC = (TempT*/1600)
        LCDout $FE,$80,"Temp ",DEC (TempC/100),".",#TempC dig 1,"C"    
        tempc=tempc/10
        
    
    I2CRead SDApin,SCLpin,$D0,$00,[RTCSec,RTCMin,RTCHour,RTCWDay,RTCDay,RTCMonth,RTCYear,RTCCtrl]  ; read DS1307 chip
    
    LCDOut $FE,$c0+11,hex2 RTCHour,":",hex2 RTCMin
    
    timeH=(RTCHour>>4)                                                       'convert the BCD format of the hours register and store in variable timeH
    timeH=(timeH &$03)*10
    timeH=timeH+(RTCHour&$0F)
    
    timeM=(RTCMin>>4)
    timeM=(timeM &$07)*10
    timeM=timeM+(RTCMin&$0F) 
    
    Hserout [dec TimeH,":",dec TimeM," ",DEC(TempC/10),".",#TempC dig 1,13,10]
    
    Pause 5000
    
    goto main
    This works fine, although I would rather data is sent once every 5 minutes. I did try and do a time match so that if minutes = 5 and seconds =0 it would send, but the program loops so fast that I still got multiple results.

    So I'm just after a quick and simple bit of code to allow me to record the temperature and time stamp every 5 minutes

    TIA

    Malc
    Last edited by Scampy; - 9th January 2018 at 19:53.

Similar Threads

  1. serial in data needs nib
    By l_gaminde in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th June 2011, 12:20
  2. Transmission!
    By uaf5000 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 25th August 2010, 04:39
  3. serial data to LCD
    By cunninghamjohn in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 25th November 2008, 15:50
  4. Replies: 7
    Last Post: - 6th February 2008, 05:38
  5. Multiplex serial data
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 19th May 2004, 00:28

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts