' ' ' ' ' ' ' ' ' ' ' ' ' ' Setting the clock on the PicStic 2 using SERIN2 ' PicBasic Pro Version 2.30 ' ' ' ' ' ' ' ' ' ' ' ' ' ' Definitions so con 7 'Sets PB7 to be used as the Serout pin si con 6 'Sets PB6 to be used as the Serin pin baud con 16468 'Baud rate 9600 8N1 inverted yr var byte 'variable for the year mn var byte 'variable for the month dow var byte 'variable for Day of the Week dom var byte 'variable for Day of the Month hr var byte 'variable for the hour mit var byte 'variable for the miniute sec var byte 'variable for the second repeat var byte 'Loop counter b19 var byte 'Command byte for call PASS b20 var byte 'LSByte of parameter for call PASS b21 var byte 'MSByte of parameter for call PASS START: serout2 so,baud, ["Enter Month and Year (mn,yr)",13,10] b19 = $28 gosub SET serout2 so,baud, ["Enter Day of Week and Day of Month (dow,dom)",13,10] b19 = $29 gosub SET serout2 so,baud, ["Enter Miniutes and Hours (mm,hh)",13,10] b19 = $2A gosub SET goto PRNT RDTIME: b19 = $24 : b20 = 00 : b21 = 00 call PASS yr = b21 : mn = b20 b19 = $25 : b20 = 00 : b21 = 00 call PASS dom = b21 : dow = b20 b19 = $26 : b20 = 00 : b21 = 00 call PASS hr = b21 : mit = b20 b19 = $27 : b20 = 00 : b21 = 00 call PASS sec = b20 return PRNT: for repeat = 0 to 3 serout2 so,baud,[hex mn,"/",hex dom,"/",hex yr,32,32,hex hr,":",hex mit,":",hex sec,13,10] gosub RDTIME next repeat goto DONE SET: serin2 si,baud,[hex2 b20, hex2 b21] call PASS return DONE: End