Hello!
I want to share a small example of working with a thermocouple on the MAX6675. I used hardware SPI and dynamic indication on a seven-segment indicator. I assembled a device for measuring the temperature in the oven.
'Chip settings
#chip16LF1829, 16
#configOsc=IntSPIModeMasterSlowDIMTemperatureasWord' Temperature value from thermocoupleDIMSegmentsBuffer(3)asByte' Symbol buffer for display on the indicatorDIMSymbols(13)' Character values from 0 to 9, empty, E, rSymbols=111, 40, 31, 62, 120, 118, 119, 44, 127, 126, 0, 87, 17
#defineSymbolE11
#defineSymbolR12
#defineClear10
#definedelay5' Time to display one characterDIML_byteasByteDIMTimerasByte' SPI
#defineCSPortA.5
#defineSCKPortB.6
#defineSOPortB.4DirSOinDirSCKoutDirCSout' 7 Segments
#defineSEG1PORTA.4
#defineSEG2PORTA.2
#defineSEG3PORTB.5DirPORTCoutDirSEG1outDirSEG2outDirSEG3outWait1sTimer=100doForeverifTimer=100thencallGetTemperatureTimer=0endifcallShowSegmentsTimer=Timer+1LoopSubGetTemperatureCS=0SPITransfer0, TemperatureTemperature=FnLSL(Temperature, 8)SPITransfer0, L_byteTemperature=TemperatureorL_byteTemperature=FnLSR(Temperature, 5)CS=1EndSubSubShowSegmentsifTemperature=1023thenSegmentsBuffer(1)=SymbolESegmentsBuffer(2)=SymbolRSegmentsBuffer(3)=SymbolRelseifTemperature>99thenSegmentsBuffer(1)=Temperature/100SegmentsBuffer(2)=Temperature%100SegmentsBuffer(2)=SegmentsBuffer(2)/10SegmentsBuffer(3)=Temperature%10elseifTemperature>9thenSegmentsBuffer(1)=ClearSegmentsBuffer(2)=Temperature/10SegmentsBuffer(3)=Temperature%10elseSegmentsBuffer(1)=ClearSegmentsBuffer(2)=ClearSegmentsBuffer(3)=TemperatureendifPORTC=Symbols(SegmentsBuffer(1)+1)SetSEG1OffSetSEG3OnWaitdelaymsPORTC=Symbols(SegmentsBuffer(2)+1)SetSEG3OffSetSEG2OnWaitdelaymsPORTC=Symbols(SegmentsBuffer(3)+1)SetSEG2OffSetSEG1OnWaitdelaymsEndSub
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
I want to share a small example of working with a thermocouple on the MAX6675. I used hardware SPI and dynamic indication on a seven-segment indicator. I assembled a device for measuring the temperature in the oven.
A very nice implementation. I really like the use of the symbols array.
Can I lift from the forum and include in the demo folders?
See https://github.com/GreatCowBASIC/Demonstration_Sources/tree/main/Temperature_Sensor_Solutions/MAX6675_Thermometer_Solutions
:-)
I'll be glad if it's useful to someone :)
I am sure it will be. Your methods are worth it!