{"id":1577,"date":"2024-07-19T13:17:40","date_gmt":"2024-07-19T12:17:40","guid":{"rendered":"https:\/\/ibex.tech\/embedded\/?p=1577"},"modified":"2024-07-19T14:02:30","modified_gmt":"2024-07-19T13:02:30","slug":"spi-using-mcc","status":"publish","type":"post","link":"https:\/\/ibex.tech\/embedded\/microchip\/pic18\/xc8-compiler\/spi-xc8-compiler\/spi-using-mcc","title":{"rendered":"SPI (using MCC)"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Example usage<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>#include \"mcc_generated_files\/spi\/mssp2.h\"\n\n\/\/INITIALISE\n\tSPI2_Open(HOST_CONFIG);\t\t\t\/\/HOST_CONFIG is the configuration we selected in MCC\n\t\n\n\/\/TRANSFER\n\tuint8_t RxData&#91;2];\n\tIO_AD7478_CS = 0;\n\n\tRxData&#91;0] = SPI2_ByteExchange(0x00);\n\tRxData&#91;1] = SPI2_ByteExchange(0x00);\n\n\tIO_AD7478_CS = 1;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">How we define it for use in our libraries<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>#define IO_EXPANDER_SPI_WRITE_BYTE(TxData)\t\t\t\t\tSPI2_ByteExchange(TxData)\n#define IO_EXPANDER_SPI_READ_BYTE(RxData)\t\t\t\t\tRxData = SPI2_ByteExchange(0x00)\n#define IO_EXPANDER_SPI_WRITE_READ_BYTE(TxData, RxData)\t\tRxData = SPI2_ByteExchange(TxData)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Example usage How we define it for use in our libraries<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[131,126],"tags":[],"class_list":["post-1577","post","type-post","status-publish","format-standard","hentry","category-pic18-peripherals","category-spi-xc8-compiler"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1577","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/comments?post=1577"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1577\/revisions"}],"predecessor-version":[{"id":1581,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/posts\/1577\/revisions\/1581"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/media?parent=1577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/categories?post=1577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/embedded\/wp-json\/wp\/v2\/tags?post=1577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}